Initial
This commit is contained in:
commit
6b229eae18
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
swf
|
||||
png
|
||||
bin
|
||||
.idea
|
||||
.settings
|
||||
old.zip
|
17
.project
Normal file
17
.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>rtmpServer</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
47
rtmpServer.iml
Normal file
47
rtmpServer.iml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="EclipseModuleManager">
|
||||
<libelement value="jar://$MODULE_DIR$/../nanohttpd-2.1.0.jar!/" />
|
||||
<libelement value="jar://$MODULE_DIR$/../sqlite-jdbc-3.20.1.jar!/" />
|
||||
<libelement value="jar://$MODULE_DIR$/../simple-xml-2.7.1.jar!/" />
|
||||
<src_description expected_position="1">
|
||||
<src_folder value="file://$MODULE_DIR$/src" expected_position="1" />
|
||||
</src_description>
|
||||
</component>
|
||||
<component name="NewModuleRootManager">
|
||||
<output url="file://$MODULE_DIR$/bin" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="openjdk-20" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="nanohttpd-2.1.0.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../nanohttpd-2.1.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="sqlite-jdbc-3.20.1.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../sqlite-jdbc-3.20.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="simple-xml-2.7.1.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../simple-xml-2.7.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
257
src/org/cl0zzzy/http/HttpMain.java
Normal file
257
src/org/cl0zzzy/http/HttpMain.java
Normal file
@ -0,0 +1,257 @@
|
||||
package org.cl0zzzy.http;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.cl0zzzy.sqlite.Account;
|
||||
import org.cl0zzzy.sqlite.DB;
|
||||
import org.cl0zzzy.rtmp.Util;
|
||||
|
||||
import fi.iki.elonen.NanoHTTPD;
|
||||
|
||||
public class HttpMain extends NanoHTTPD {
|
||||
|
||||
private int port;
|
||||
private int rtmp;
|
||||
private int count = 0;
|
||||
|
||||
public HttpMain(int port, int rtmp) {
|
||||
super(port);
|
||||
System.out.println("HTTP daemon started");
|
||||
this.port = port;
|
||||
this.rtmp = rtmp;
|
||||
try {
|
||||
this.start();
|
||||
} catch( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void updatePlayers( int count ) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response serve(IHTTPSession session) {
|
||||
String response = "<html><body><h1>404</h1></body></html>";
|
||||
try {
|
||||
Map<String, String> p = session.getParms();
|
||||
if (session.getUri().startsWith("/png/")) {
|
||||
try {
|
||||
return parsePNG(session.getUri().substring(4));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (session.getUri().startsWith("/swf/")) {
|
||||
try {
|
||||
return parseSWF(session.getUri().substring(4));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (session.getUri().endsWith(".swf")) {
|
||||
try {
|
||||
return parseSWFN(session.getUri().substring(1));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (session.getUri().startsWith("/css/")) {
|
||||
return parseCSS(session.getUri().substring(4));
|
||||
} else if (session.getUri().startsWith("/async/")) {
|
||||
if (session.getUri().equals("/async/ServerAction")) {
|
||||
if (session.getCookies().read("UID") != null && session.getCookies().read("TOKEN") != null) {
|
||||
if (Util.MD5(DB.getSecureCode() + session.getCookies().read("UID")).equals(session.getCookies().read("TOKEN"))) {
|
||||
response = this.generateServerAction(Integer.parseInt(session.getCookies().read("UID")));
|
||||
return new NanoHTTPD.Response(Response.Status.OK, "text/xml;charset=UTF-8", response);
|
||||
}
|
||||
}
|
||||
response = "<?xml version=\"1.0\" encoding=\"utf-8\"?><response/>";
|
||||
return new NanoHTTPD.Response(Response.Status.OK, "text/xml;charset=UTF-8", response);
|
||||
} else if (session.getUri().equals("/async/Ping")) {
|
||||
response = "<response isPong=\"true\" />";
|
||||
return new NanoHTTPD.Response(Response.Status.OK, "text/xml;charset=UTF-8", response);
|
||||
}
|
||||
} else if (session.getUri().startsWith("/img/")) {
|
||||
return parseImg(session.getUri().substring(4));
|
||||
} else {
|
||||
if (session.getCookies().read("UID") != null && session.getCookies().read("TOKEN") != null) {
|
||||
if (Util.MD5(DB.getSecureCode() + session.getCookies().read("UID")).equals(session.getCookies().read("TOKEN"))) {
|
||||
session.getCookies().set(new Cookie("UID", session.getCookies().read("UID")));
|
||||
session.getCookies().set(new Cookie("TOKEN", Util.MD5(DB.getSecureCode() + session.getCookies().read("UID"))));
|
||||
NanoHTTPD.Response nr = new NanoHTTPD.Response(parseMain().replaceAll("REPLACE_FOR_DOMAIN", "localhost:" + port));
|
||||
return nr;
|
||||
} else {
|
||||
session.getCookies().delete("UID");
|
||||
session.getCookies().delete("TOKEN");
|
||||
}
|
||||
}
|
||||
Map<String, String> prms = new HashMap<String, String>();
|
||||
try {
|
||||
session.parseBody(prms);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ResponseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
p = session.getParms();
|
||||
if (p.get("username") != null && p.get("password") != null) {
|
||||
if (p.get("act") != null) {
|
||||
String regex = "^[a-zA-z а-яА-Я0-9\\_\\-]{3,30}$";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(p.get("username"));
|
||||
if (matcher.matches() && DB.getUserAccountByName(p.get("username")) == null) {
|
||||
DB.insertAccount(p.get("username"), p.get("password"));
|
||||
response = parseLog();
|
||||
return new NanoHTTPD.Response(response);
|
||||
}
|
||||
} else {
|
||||
Account acc = DB.getUserAccountByName(p.get("username"));
|
||||
if (acc != null && acc.getPassword().equals(Util.MD5(p.get("password")))) {
|
||||
session.getCookies().set(new Cookie("TOKEN", Util.MD5(DB.getSecureCode() + acc.getId())));
|
||||
session.getCookies().set(new Cookie("UID", acc.getId() + ""));
|
||||
NanoHTTPD.Response nr = new NanoHTTPD.Response(parseMain().replaceAll("REPLACE_FOR_DOMAIN", "localhost:" + port));
|
||||
return nr;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p.get("act") != null) {
|
||||
response = parseReg();
|
||||
} else {
|
||||
response = parseLog();
|
||||
}
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new NanoHTTPD.Response(response);
|
||||
}
|
||||
|
||||
private Response parsePNG(String png) throws Exception {
|
||||
return getRespFromIS("image/png", new FileInputStream(new File("png"+png)));
|
||||
}
|
||||
|
||||
private Response parseSWF(String swf) throws Exception {
|
||||
return getRespFromIS("application/x-shockwave-flash", new FileInputStream(new File("swf"+swf)));
|
||||
}
|
||||
|
||||
private Response parseSWFN(String swf) throws Exception {
|
||||
return getRespFromIS("application/x-shockwave-flash", new FileInputStream(new File(swf)));
|
||||
}
|
||||
|
||||
private String parseMain() {
|
||||
return getStringFromIS(getFileFromResourceAsStream("/res/main.html"));
|
||||
}
|
||||
|
||||
private String parseReg() {
|
||||
return getStringFromIS(getFileFromResourceAsStream("/res/reg.html"));
|
||||
}
|
||||
|
||||
private String parseLog() {
|
||||
return getStringFromIS(getFileFromResourceAsStream("/res/log.html"));
|
||||
}
|
||||
|
||||
private NanoHTTPD.Response parseImg( String filename ) {
|
||||
return getRespFromIS("image/jpeg", (FileInputStream) getFileFromResourceAsStream("/res/img" + filename));
|
||||
}
|
||||
|
||||
private NanoHTTPD.Response parseCSS( String filename ) {
|
||||
return getRespFromIS("text/css", (FileInputStream) getFileFromResourceAsStream("/res/css" + filename));
|
||||
}
|
||||
|
||||
private NanoHTTPD.Response getRespFromIS( String mime, FileInputStream fis ) {
|
||||
NanoHTTPD.Response res = new NanoHTTPD.Response(Response.Status.OK, mime, fis);
|
||||
return res;
|
||||
}
|
||||
|
||||
private InputStream getFileFromResourceAsStream(String fileName) {
|
||||
try {
|
||||
return new FileInputStream(Paths.get(this.getClass().getResource(fileName).toURI()).toFile());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getStringFromIS(InputStream is) {
|
||||
String data = "";
|
||||
try (InputStreamReader streamReader =
|
||||
new InputStreamReader(is, StandardCharsets.UTF_8);
|
||||
BufferedReader reader = new BufferedReader(streamReader)) {
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
data += line;
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private String generateServerAction( int UID ) {
|
||||
String response = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
|
||||
"<response>\r\n" +
|
||||
"<sn_status IsBinded=\"0\" />\r\n" +
|
||||
"<user_name Value=\""+ DB.getPlayerName( UID ) +"\" />\r\n" +
|
||||
"<preloader>\r\n" +
|
||||
DB.getPreloaders()+
|
||||
"</preloader>\r\n" +
|
||||
"<flags IsUserDetailsMissing=\"1\" EntranceCount=\"13\" />\r\n" +
|
||||
"<tutorial>\r\n" +
|
||||
" <item Id=\"-1\" State=\"1\" />\r\n" +
|
||||
" <item Id=\"1\" State=\"1\" />\r\n" +
|
||||
" <item Id=\"2\" State=\"1\" />\r\n" + // 1
|
||||
" <item Id=\"3\" State=\"1\" />\r\n" +
|
||||
" <item Id=\"4\" State=\"1\" />\r\n" +
|
||||
" <item Id=\"5\" State=\"1\" />" +
|
||||
"</tutorial>\r\n" +
|
||||
"<grants ReceivingCount=\"0\" />\r\n" +
|
||||
"<requests ReceivingCount=\"0\" />\r\n" +
|
||||
"<promotion>\r\n" +
|
||||
DB.getPromotions()+
|
||||
"</promotion>\r\n" +
|
||||
"<promotion_banner>\r\n" +
|
||||
DB.getPromotionBanners()+
|
||||
"</promotion_banner>\r\n" +
|
||||
"<phone>\r\n" +
|
||||
" <messages>\r\n" +
|
||||
" "+DB.getPhoneMessages(UID)+"\r\n" +
|
||||
" </messages>\r\n" +
|
||||
"</phone>\r\n" +
|
||||
"<postcard>\r\n" +
|
||||
" <messages>\r\n" +
|
||||
" "+DB.getPostcards(UID)+"\r\n" +
|
||||
" </messages>\r\n" +
|
||||
"</postcard>\r\n" +
|
||||
"<miniquest>\r\n" +
|
||||
//" <i Id=\"1000001\" MiniquestId=\"1000001\" IsPostponed=\"0\" StartDate=\"2019-01-11T21:32:57.883\">\r\n" +
|
||||
//" <i Id=\"10000011\" TaskId=\"10000011\" IsFinished=\"0\" Counter=\"0\" /></i>" +
|
||||
"</miniquest>\r\n" +
|
||||
"<cdata value=\"" +Util.bytesToHex(new RC4("_level0".getBytes()).encrypt("<config><item Id=\"1\" Parameter=\"IsPreloaderEnabled\" Value=\"1\" Type=\"bool\" /><item Id=\"2\" Parameter=\"SynchronizeAvatarRotation\" Value=\"1\" Type=\"bool\" /><item Id=\"3\" Parameter=\"InitialVolumeValue\" Value=\"30\" Type=\"number\" /><item Id=\"4\" Parameter=\"IsStartupHomeLocation\" Value=\"0\" Type=\"bool\" /><item Id=\"5\" Parameter=\"AccessRoleFlags\" Value=\"0\" Type=\"number\" /><item Id=\"6\" Parameter=\"IsInternational\" Value=\"0\" Type=\"bool\" /><item Id=\"7\" Parameter=\"TypeWeapon\" Value=\"1\" Type=\"number\" /><item Id=\"8\" Parameter=\"StatisticsSendInterval\" Value=\"300\" Type=\"number\" /><item Id=\"9\" Parameter=\"SwfVersion\" Value=\"\" Type=\"string\" /><item Id=\"10\" Parameter=\"LanguageId\" Value=\"1\" Type=\"number\" /><item Id=\"11\" Parameter=\"SnId\" Value=\"1\" Type=\"number\" /><item Id=\"12\" Parameter=\"AutoServerSelectionAllowed\" Value=\"0\" Type=\"bool\" /></config>".getBytes())).toLowerCase() + "\" />\r\n" +
|
||||
"<cdata value=\""+ Util.bytesToHex(new RC4("_level0".getBytes()).encrypt(("<system ServerDate=\""+this.getDate()+"\" RPath=\"swf/cache/rus/resources[19].swf\" RVersion=\"1\" />").getBytes())).toLowerCase() +"\" />\r\n" +
|
||||
"<cdata value=\""+ Util.bytesToHex(new RC4("_level0".getBytes()).encrypt(("<user UserId=\""+UID+"\" hwId=\""+UUID.randomUUID().toString()+"\" ticketId=\""+UUID.randomUUID().toString()+"\" RoleFlags=\""+DB.getRoleFlags(UID)+"\" />").getBytes())).toLowerCase() +"\" />\r\n" +
|
||||
""+"<cdata value=\""+ Util.bytesToHex(new RC4("_level0".getBytes()).encrypt(("<servers><item Id=\"1\" TRId=\"202\" RId=\"5\" RTMPUrl=\"rtmp://localhost:"+this.rtmp+"/shararam\" Load=\""+String.valueOf(this.count)+"\" FriendsCount=\"1\" ClubsCount=\"5\" Weight=\"5.1\" /></servers>").getBytes())).toLowerCase() +"\" />"+"\r\n" +
|
||||
"</response>";
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
private String getDate() {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = new Date();
|
||||
return format.format(date);
|
||||
}
|
||||
}
|
49
src/org/cl0zzzy/http/RC4.java
Normal file
49
src/org/cl0zzzy/http/RC4.java
Normal file
@ -0,0 +1,49 @@
|
||||
package org.cl0zzzy.http;
|
||||
|
||||
public class RC4 {
|
||||
private final byte[] S = new byte[256];
|
||||
private final byte[] T = new byte[256];
|
||||
private final int keylen;
|
||||
|
||||
public RC4(final byte[] key) {
|
||||
if (key.length < 1 || key.length > 256) {
|
||||
throw new IllegalArgumentException(
|
||||
"key must be between 1 and 256 bytes");
|
||||
} else {
|
||||
keylen = key.length;
|
||||
for (int i = 0; i < 256; i++) {
|
||||
S[i] = (byte) i;
|
||||
T[i] = key[i % keylen];
|
||||
}
|
||||
int j = 0;
|
||||
byte tmp;
|
||||
for (int i = 0; i < 256; i++) {
|
||||
j = (j + S[i] + T[i]) & 0xFF;
|
||||
tmp = S[j];
|
||||
S[j] = S[i];
|
||||
S[i] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] encrypt(final byte[] plaintext) {
|
||||
final byte[] ciphertext = new byte[plaintext.length];
|
||||
int i = 0, j = 0, k, t;
|
||||
byte tmp;
|
||||
for (int counter = 0; counter < plaintext.length; counter++) {
|
||||
i = (i + 1) & 0xFF;
|
||||
j = (j + S[i]) & 0xFF;
|
||||
tmp = S[j];
|
||||
S[j] = S[i];
|
||||
S[i] = tmp;
|
||||
t = (S[i] + S[j]) & 0xFF;
|
||||
k = S[t];
|
||||
ciphertext[counter] = (byte) (plaintext[counter] ^ k);
|
||||
}
|
||||
return ciphertext;
|
||||
}
|
||||
|
||||
public byte[] decrypt(final byte[] ciphertext) {
|
||||
return encrypt(ciphertext);
|
||||
}
|
||||
}
|
213
src/org/cl0zzzy/rtmp/AMF.java
Normal file
213
src/org/cl0zzzy/rtmp/AMF.java
Normal file
@ -0,0 +1,213 @@
|
||||
package org.cl0zzzy.rtmp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class AMF {
|
||||
|
||||
private ArrayList<AMFObject> AMFMessage = new ArrayList<AMFObject>();
|
||||
private byte[] amf;
|
||||
|
||||
public boolean next = false;
|
||||
public byte[] nextArr;
|
||||
|
||||
public AMF( byte[] amf ) {
|
||||
this.amf = amf;
|
||||
this.decodeAMF();
|
||||
}
|
||||
|
||||
private AMFResult decodeNumber( int i ) {
|
||||
byte[] number = new byte[8];
|
||||
number[0] = amf[i+1];
|
||||
number[1] = amf[i+2];
|
||||
number[2] = amf[i+3];
|
||||
number[3] = amf[i+4];
|
||||
number[4] = amf[i+5];
|
||||
number[5] = amf[i+6];
|
||||
number[6] = amf[i+7];
|
||||
number[7] = amf[i+8];
|
||||
AMFResult result = new AMFResult();
|
||||
result.value = this.numberToDouble( Util.bytesToHex( number ) );
|
||||
result.index = i+8;
|
||||
return result;
|
||||
}
|
||||
|
||||
private AMFResult decodeString( int i ) {
|
||||
byte[] stringLength = new byte[2];
|
||||
stringLength[0] = amf[i+1];
|
||||
stringLength[1] = amf[i+2];
|
||||
int length = Integer.parseInt( Util.bytesToHex(stringLength), 16 );
|
||||
ArrayList<Byte> str = new ArrayList<Byte>();
|
||||
for( int u = (i+3); u < (i+3+length); u++ ) {
|
||||
str.add( amf[u] );
|
||||
}
|
||||
AMFResult result = new AMFResult();
|
||||
byte[] _a = new byte[str.size()];
|
||||
int j = 0;
|
||||
for(Byte b : str) {
|
||||
_a[j++] = b.byteValue();
|
||||
}
|
||||
try { result.value = new String( _a, "UTF-8" ); } catch( Exception e ) { e.printStackTrace(); }
|
||||
result.index = i+2+length;
|
||||
return result;
|
||||
}
|
||||
|
||||
private AMFResult decodeECMA( int i ) {
|
||||
AMFEcmaArray ecma = new AMFEcmaArray();
|
||||
if( amf[i] == AMFObject.AMF_ECMA_ARRAY_START &&
|
||||
amf[i+1] == 0x00 &&
|
||||
amf[i+2] == 0x00 &&
|
||||
amf[i+3] == 0x00 &&
|
||||
amf[i+4] == 0x00 &&
|
||||
amf[i+5] == 0x00 &&
|
||||
amf[i+6] == 0x00 &&
|
||||
amf[i+7] == AMFObject.AMF_OBJECT_END ) {
|
||||
i = i + 7;
|
||||
AMFResult result = new AMFResult();
|
||||
result.value = ecma;
|
||||
result.index = i;
|
||||
return result;
|
||||
}
|
||||
i+=5;
|
||||
int index = 0;
|
||||
while( true ) {
|
||||
if( amf[i] == 0x00 && amf[i+1] == 0x00 && amf[i+2] == 0x09 ) {
|
||||
i = i + 2;
|
||||
break;
|
||||
}
|
||||
i+=3;
|
||||
|
||||
int __index = index;
|
||||
__index = __index - ( __index % 10 );
|
||||
if( __index > 0 ) {
|
||||
int len = String.valueOf(__index).substring(1).length();
|
||||
i += len;
|
||||
}
|
||||
Result res = this.decodeOne(i);
|
||||
AMFObject value = new AMFObject( amf[i], res.val );
|
||||
ecma.add(value);
|
||||
i = res.i;
|
||||
i++;
|
||||
index++;
|
||||
}
|
||||
AMFResult result = new AMFResult();
|
||||
result.value = ecma;
|
||||
result.index = i;
|
||||
return result;
|
||||
}
|
||||
|
||||
private AMFResult decodeObj( int i ) {
|
||||
i++;
|
||||
AMFObjectArray array = new AMFObjectArray();
|
||||
while( true ) {
|
||||
if( amf[i] == 0x00 && amf[i+1] == 0x00 && amf[i+2] == 0x09 ) {
|
||||
i = i + 2;
|
||||
break;
|
||||
}
|
||||
byte[] length = new byte[2];
|
||||
length[0] = amf[i];
|
||||
length[1] = amf[i+1];
|
||||
|
||||
int decimal = Integer.parseInt( Util.bytesToHex(length), 16 );
|
||||
String key = "";
|
||||
for( int u = i+2; u < (i+2+decimal); u++ ) {
|
||||
key = key + new String( new byte[] {amf[u]} );
|
||||
}
|
||||
|
||||
Result res = this.decodeOne(i+2+decimal);
|
||||
AMFObject obj = new AMFObject( amf[i+2+decimal], res.val );
|
||||
array.add(key, obj);
|
||||
i = res.i + 1;
|
||||
}
|
||||
|
||||
|
||||
AMFResult result = new AMFResult();
|
||||
result.value = array;
|
||||
result.index = i;
|
||||
return result;
|
||||
}
|
||||
|
||||
private Result decodeOne( int i ) {
|
||||
Object val = null;
|
||||
if( amf[i] == AMFObject.AMF_NUMBER ) {
|
||||
AMFResult result = this.decodeNumber(i);
|
||||
val = result.value;
|
||||
i = result.index;
|
||||
} else if( amf[i] == AMFObject.AMF_STRING ) {
|
||||
AMFResult result = this.decodeString(i);
|
||||
val = result.value;
|
||||
i = result.index;
|
||||
} else if( amf[i] == AMFObject.AMF_BOOLEAN ) {
|
||||
if( amf[i+1] == 0x00 ) {
|
||||
val = false;
|
||||
} else {
|
||||
val = true;
|
||||
}
|
||||
i++;
|
||||
} else if( amf[i] == AMFObject.AMF_OBJECT_START ) {
|
||||
AMFResult result = this.decodeObj(i);
|
||||
val = result.value;
|
||||
i = result.index;
|
||||
} else if( amf[i] == AMFObject.AMF_NULL ) {
|
||||
val = null;
|
||||
} else if( amf[i] == AMFObject.AMF_ECMA_ARRAY_START ) {
|
||||
AMFResult result = this.decodeECMA(i);
|
||||
val = result.value;
|
||||
i = result.index;
|
||||
} else if( amf[i] == AMFObject.AMF_DATE ) {
|
||||
val = "Date";
|
||||
i = i + 10;
|
||||
} else if( amf[i] == (byte) 0x43 || amf[i] == (byte) 0x83 ){
|
||||
val = "end";
|
||||
next = true;
|
||||
nextArr = Arrays.copyOfRange(amf, i, amf.length);
|
||||
}
|
||||
Result res = new Result();
|
||||
res.i = i;
|
||||
res.val = val;
|
||||
return res;
|
||||
}
|
||||
|
||||
private void decodeAMF() {
|
||||
for( int i = 0; i < amf.length; i++ ) {
|
||||
Object val = null;
|
||||
int _i = i;
|
||||
Result res = this.decodeOne( i );
|
||||
i = res.i;
|
||||
val = res.val;
|
||||
if( val != null && val.equals("end") ) {
|
||||
break;
|
||||
}
|
||||
if( amf[_i] != AMFObject.AMF_BOOLEAN &&
|
||||
amf[_i] != AMFObject.AMF_ECMA_ARRAY_START &&
|
||||
amf[_i] != AMFObject.AMF_NUMBER &&
|
||||
amf[_i] != AMFObject.AMF_OBJECT_START &&
|
||||
amf[_i] != AMFObject.AMF_STRING ) {
|
||||
amf[_i] = AMFObject.AMF_NULL;
|
||||
}
|
||||
AMFObject value = new AMFObject( amf[_i], val );
|
||||
AMFMessage.add(value);
|
||||
}
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return this.AMFMessage.size();
|
||||
}
|
||||
|
||||
public AMFObject get( int index ) {
|
||||
return this.AMFMessage.get(index);
|
||||
}
|
||||
|
||||
private double numberToDouble( String hexString ) {
|
||||
long longHex = parseUnsignedHex(hexString);
|
||||
return Double.longBitsToDouble(longHex);
|
||||
}
|
||||
|
||||
private long parseUnsignedHex(String text) {
|
||||
if (text.length() == 16) {
|
||||
return (parseUnsignedHex(text.substring(0, 1)) << 60)
|
||||
| parseUnsignedHex(text.substring(1));
|
||||
}
|
||||
return Long.parseLong(text, 16);
|
||||
}
|
||||
}
|
177
src/org/cl0zzzy/rtmp/AMFBuilder.java
Normal file
177
src/org/cl0zzzy/rtmp/AMFBuilder.java
Normal file
@ -0,0 +1,177 @@
|
||||
package org.cl0zzzy.rtmp;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AMFBuilder {
|
||||
|
||||
private ArrayList<AMFObject> objs = new ArrayList<AMFObject>();
|
||||
|
||||
private byte[] timestamp = new byte[] { 0x00, 0x00, 0x00 };
|
||||
|
||||
private byte empty = 0x00;
|
||||
private byte ver = 0x03;
|
||||
private byte amf = 0x14;
|
||||
private byte _true = 0x01;
|
||||
private byte _false = 0x00;
|
||||
|
||||
public AMFBuilder() {}
|
||||
|
||||
public void setTimestamp( byte[] ts ) {
|
||||
this.timestamp = ts;
|
||||
}
|
||||
|
||||
public void addAMFObject( AMFObject obj ) {
|
||||
this.objs.add(obj);
|
||||
}
|
||||
|
||||
private ArrayList<Byte> encodeNumber( String str ) {
|
||||
ArrayList<Byte> result = new ArrayList<Byte>();
|
||||
byte[] arr = Util.hexStringToByteArray( this.doubleToNumber( Double.parseDouble(str) ) );
|
||||
for( int i = 0; i < arr.length; i++ ) {
|
||||
result.add(arr[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private ArrayList<Byte> encodeString( String str ) {
|
||||
ArrayList<Byte> result = new ArrayList<Byte>();
|
||||
byte[] data = new byte[2];
|
||||
data[1] = (byte) (str.getBytes().length & 0xFF);
|
||||
data[0] = (byte) ((str.getBytes().length >> 8) & 0xFF);
|
||||
result.add(data[0]);
|
||||
result.add(data[1]);
|
||||
for( int i = 0; i < str.getBytes().length; i++ ) {
|
||||
result.add(str.getBytes()[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private ArrayList<Byte> encodeBoolean( Boolean b ) {
|
||||
ArrayList<Byte> result = new ArrayList<Byte>();
|
||||
if( b ) {
|
||||
result.add(this._true);
|
||||
} else {
|
||||
result.add(this._false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private ArrayList<Byte> encodeECMA( AMFEcmaArray ecma ) {
|
||||
ArrayList<Byte> result = new ArrayList<Byte>();
|
||||
result.add((byte)0x00);
|
||||
result.add((byte)0x00);
|
||||
result.add((byte)0x00);
|
||||
result.add((byte)0x00);
|
||||
for( int i = 0; i < ecma.getLength(); i++ ) {
|
||||
result.add((byte)0x00);
|
||||
result.add((byte) (Math.floor(i/10)+1));
|
||||
byte[] b = Util.hexStringToByteArray(toHex(String.valueOf(i)));
|
||||
for( int u = 0; u < b.length; u++ ) {
|
||||
result.add(b[u]);
|
||||
}
|
||||
ArrayList<Byte> _b = this.encodeAMFObject( ecma.getValueAt(i) );
|
||||
for( int u = 0; u < _b.size(); u++ ) {
|
||||
result.add(_b.get(u));
|
||||
}
|
||||
}
|
||||
result.add((byte)0x00);
|
||||
result.add((byte)0x00);
|
||||
result.add((byte)0x09);
|
||||
return result;
|
||||
}
|
||||
|
||||
private ArrayList<Byte> encodeObj( AMFObjectArray arr ) {
|
||||
ArrayList<Byte> result = new ArrayList<Byte>();
|
||||
for( int i = 0; i < arr.getLength(); i++ ) {
|
||||
ArrayList<Byte> key = this.encodeString(arr.getKeyAt(i));
|
||||
ArrayList<Byte> body = this.encodeAMFObject(arr.getValueAt(i));
|
||||
for( int u = 0; u < key.size(); u++ ) {
|
||||
result.add(key.get(u));
|
||||
}
|
||||
result.add(arr.getValueAt(i).getType());
|
||||
for( int u = 0; u < body.size(); u++ ) {
|
||||
result.add(body.get(u));
|
||||
}
|
||||
}
|
||||
result.add((byte)0x00);
|
||||
result.add((byte)0x00);
|
||||
result.add(AMFObject.AMF_OBJECT_END);
|
||||
return result;
|
||||
}
|
||||
|
||||
private ArrayList<Byte> encodeAMFObject( AMFObject obj ) {
|
||||
ArrayList<Byte> result = new ArrayList<Byte>();
|
||||
if( obj.getType() == AMFObject.AMF_NUMBER ) {
|
||||
result = this.encodeNumber( obj.getString() );
|
||||
} else if( obj.getType() == AMFObject.AMF_STRING ) {
|
||||
result = this.encodeString( obj.getString() );
|
||||
} else if( obj.getType() == AMFObject.AMF_BOOLEAN ) {
|
||||
result = this.encodeBoolean( obj.getBoolean() );
|
||||
} else if( obj.getType() == AMFObject.AMF_OBJECT_START ) {
|
||||
result = this.encodeObj( obj.getObjectArray() );
|
||||
} else if( obj.getType() == AMFObject.AMF_ECMA_ARRAY_START ) {
|
||||
result = this.encodeECMA( obj.getECMArray() );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public byte[] build() {
|
||||
ArrayList<Byte> array = new ArrayList<Byte>();
|
||||
array.add(ver);
|
||||
array.add(this.timestamp[0]);
|
||||
array.add(this.timestamp[1]);
|
||||
array.add(this.timestamp[2]);
|
||||
array.add(empty);
|
||||
array.add(empty);
|
||||
array.add(empty);
|
||||
array.add(amf);
|
||||
array.add(empty);
|
||||
array.add(empty);
|
||||
array.add(empty);
|
||||
array.add(empty);
|
||||
ArrayList<Byte> _array = new ArrayList<Byte>();
|
||||
for( int i = 0; i < this.objs.size(); i++ ) {
|
||||
AMFObject obj = this.objs.get(i);
|
||||
_array.add(obj.getType());
|
||||
ArrayList<Byte> nb = this.encodeAMFObject( obj );
|
||||
for( int u = 0; u < nb.size(); u++ ) {
|
||||
_array.add(nb.get(u));
|
||||
}
|
||||
}
|
||||
int cnt = 0;
|
||||
for( int i = 0; i < _array.size(); i++ ) {
|
||||
array.add(_array.get(i));
|
||||
if( i >= 4095 && ((i+1) % 4096 == 0) && (i+1) < _array.size() ) {
|
||||
array.add((byte) 0xC3);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
int length = array.size() - 12 - cnt;
|
||||
byte[] ldata = new byte[3];
|
||||
ldata[2] = (byte) (length & 0xFF);
|
||||
ldata[1] = (byte) ((length >> 8) & 0xFF);
|
||||
ldata[0] = (byte) ((length >> 16) & 0xFF);
|
||||
array.set(4, ldata[0]);
|
||||
array.set(5, ldata[1]);
|
||||
array.set(6, ldata[2]);
|
||||
int j=0;
|
||||
byte[] _a = new byte[array.size()];
|
||||
for(Byte b : array) {
|
||||
_a[j++] = b.byteValue();
|
||||
}
|
||||
return _a;
|
||||
}
|
||||
|
||||
private String doubleToNumber( double d ) {
|
||||
long longBits = Double.doubleToLongBits(d);
|
||||
if( longBits == 0 ) {
|
||||
return "0000000000000000";
|
||||
}
|
||||
return Long.toHexString(longBits).toUpperCase();
|
||||
}
|
||||
|
||||
public String toHex(String arg) {
|
||||
return String.format("%040x", new BigInteger(1, arg.getBytes()));
|
||||
}
|
||||
}
|
37
src/org/cl0zzzy/rtmp/AMFEcmaArray.java
Normal file
37
src/org/cl0zzzy/rtmp/AMFEcmaArray.java
Normal file
@ -0,0 +1,37 @@
|
||||
package org.cl0zzzy.rtmp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AMFEcmaArray {
|
||||
|
||||
private ArrayList<AMFObject> values = new ArrayList<AMFObject>();
|
||||
|
||||
public void add( AMFObject value ) {
|
||||
this.values.add(value);
|
||||
}
|
||||
|
||||
public AMFObject getValueAt( int index ) {
|
||||
return this.values.get(index);
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return this.values.size();
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
String str = "Array";
|
||||
for( int i = 0; i < this.getLength(); i++ ) {
|
||||
str = str + "\nArray -> " + i + "=" + this.getValueAt(i).getString();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String str = "Array";
|
||||
for( int i = 0; i < this.getLength(); i++ ) {
|
||||
str = str + "\nArray -> " + i + "=" + this.getValueAt(i).toString(false);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
92
src/org/cl0zzzy/rtmp/AMFObject.java
Normal file
92
src/org/cl0zzzy/rtmp/AMFObject.java
Normal file
@ -0,0 +1,92 @@
|
||||
package org.cl0zzzy.rtmp;
|
||||
|
||||
public class AMFObject {
|
||||
|
||||
public static final byte AMF_NUMBER = 0x00;
|
||||
public static final byte AMF_BOOLEAN = 0x01;
|
||||
public static final byte AMF_STRING = 0x02;
|
||||
public static final byte AMF_OBJECT_START = 0x03;
|
||||
public static final byte AMF_ECMA_ARRAY_START = 0x08;
|
||||
public static final byte AMF_OBJECT_END = 0x09;
|
||||
public static final byte AMF_NULL = 0x05;
|
||||
public static final byte AMF_DATE = (byte) 0x0b;
|
||||
|
||||
private byte type;
|
||||
private Object body;
|
||||
|
||||
public AMFObject( byte type, Object body ) {
|
||||
this.type = type;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
|
||||
public AMFObjectArray getObjectArray() {
|
||||
return (AMFObjectArray) this.body;
|
||||
}
|
||||
|
||||
public AMFEcmaArray getECMArray() {
|
||||
return (AMFEcmaArray) this.body;
|
||||
}
|
||||
|
||||
public int getInt() {
|
||||
return (int) (this.getDouble());
|
||||
}
|
||||
|
||||
public double getDouble() {
|
||||
if( this.body != null ) {
|
||||
return Double.parseDouble( String.valueOf( this.body ) );
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
if( this.getType() == AMFObject.AMF_OBJECT_START ) {
|
||||
String str = "Object";
|
||||
AMFObjectArray obj = this.getObjectArray();
|
||||
for( int i = 0; i < obj.getLength(); i++ ) {
|
||||
str = str + "\nObject -> " + obj.getKeyAt(i) + "=" + obj.getValueAt(i).getString();
|
||||
}
|
||||
return str;
|
||||
} else if( this.getType() == AMFObject.AMF_ECMA_ARRAY_START ) {
|
||||
String str = "Array";
|
||||
AMFEcmaArray obj = this.getECMArray();
|
||||
for( int i = 0; i < obj.getLength(); i++ ) {
|
||||
str = str + "\nArray -> " + i + "=" + obj.getValueAt(i).getString();
|
||||
}
|
||||
return str;
|
||||
} else {
|
||||
return String.valueOf( this.body );
|
||||
}
|
||||
}
|
||||
|
||||
public Object get() {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
public byte getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public Boolean isNull() {
|
||||
return ( this.body == null );
|
||||
}
|
||||
|
||||
public Boolean getBoolean() {
|
||||
return Boolean.valueOf( this.getString() );
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.getString();
|
||||
}
|
||||
|
||||
public String toString( boolean i ) {
|
||||
if( this.getType() == AMFObject.AMF_OBJECT_START ) {
|
||||
return "Object";
|
||||
} else if( this.getType() == AMFObject.AMF_ECMA_ARRAY_START ) {
|
||||
return "Array";
|
||||
} else {
|
||||
return String.valueOf( this.body );
|
||||
}
|
||||
}
|
||||
}
|
54
src/org/cl0zzzy/rtmp/AMFObjectArray.java
Normal file
54
src/org/cl0zzzy/rtmp/AMFObjectArray.java
Normal file
@ -0,0 +1,54 @@
|
||||
package org.cl0zzzy.rtmp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AMFObjectArray {
|
||||
|
||||
private ArrayList<String> keys = new ArrayList<String>();
|
||||
private ArrayList<AMFObject> values = new ArrayList<AMFObject>();
|
||||
|
||||
public AMFObjectArray() {}
|
||||
|
||||
public void add( String key, AMFObject value ) {
|
||||
this.keys.add(key);
|
||||
this.values.add(value);
|
||||
}
|
||||
|
||||
public AMFObject getValueAt( int index ) {
|
||||
return this.values.get(index);
|
||||
}
|
||||
|
||||
public String getKeyAt( int index ) {
|
||||
return this.keys.get(index);
|
||||
}
|
||||
|
||||
public AMFObject get( String key ) {
|
||||
for( int i = 0; i < keys.size(); i++ ) {
|
||||
if( keys.get(i).equals(key) ) {
|
||||
return values.get(i);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return keys.size();
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
String str = "Object";
|
||||
for( int i = 0; i < this.getLength(); i++ ) {
|
||||
str = str + "\nObject -> " + this.getKeyAt(i) + "=" + this.getValueAt(i).getString();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String str = "Object";
|
||||
for( int i = 0; i < this.getLength(); i++ ) {
|
||||
str = str + "\nObject -> " + this.getKeyAt(i) + "=" + this.getValueAt(i).toString(false);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
6
src/org/cl0zzzy/rtmp/AMFResult.java
Normal file
6
src/org/cl0zzzy/rtmp/AMFResult.java
Normal file
@ -0,0 +1,6 @@
|
||||
package org.cl0zzzy.rtmp;
|
||||
|
||||
public class AMFResult {
|
||||
public Object value;
|
||||
public int index;
|
||||
}
|
134
src/org/cl0zzzy/rtmp/Chunk.java
Normal file
134
src/org/cl0zzzy/rtmp/Chunk.java
Normal file
@ -0,0 +1,134 @@
|
||||
package org.cl0zzzy.rtmp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class Chunk {
|
||||
|
||||
private byte[] timestamp = new byte[0];
|
||||
private byte[] length = new byte[0];
|
||||
private byte[] amf;
|
||||
|
||||
private byte type;
|
||||
|
||||
public Chunk( byte[] array ) {
|
||||
type = array[0];
|
||||
if( array[0] == 0x03 ) {
|
||||
timestamp = Arrays.copyOfRange( array, 1, 4 );
|
||||
length = Arrays.copyOfRange( array, 4, 7 );
|
||||
amf = Arrays.copyOfRange( array, 12, 12+getDecimalLength() );
|
||||
} else if( array[0] == 0x43 ) {
|
||||
timestamp = Arrays.copyOfRange( array, 1, 4 );
|
||||
length = Arrays.copyOfRange( array, 4, 7 );
|
||||
amf = Arrays.copyOfRange( array, 8, 8+getDecimalLength() );
|
||||
if( 8+getDecimalLength() < array.length ) {
|
||||
amf = Arrays.copyOfRange( array, 8, array.length );
|
||||
}
|
||||
} else if( array[0] == (byte) 0x83 ) {
|
||||
timestamp = Arrays.copyOfRange( array, 1, 4 );
|
||||
amf = Arrays.copyOfRange( array, 4, array.length );
|
||||
}
|
||||
this.clearC3();
|
||||
}
|
||||
|
||||
public Chunk( byte[] array, boolean ignore ) {
|
||||
type = array[0];
|
||||
if( array[0] == 0x03 ) {
|
||||
timestamp = Arrays.copyOfRange( array, 1, 4 );
|
||||
length = Arrays.copyOfRange( array, 4, 7 );
|
||||
amf = Arrays.copyOfRange( array, 12, array.length );
|
||||
} else if( array[0] == 0x43 ) {
|
||||
timestamp = Arrays.copyOfRange( array, 1, 4 );
|
||||
length = Arrays.copyOfRange( array, 4, 7 );
|
||||
amf = Arrays.copyOfRange( array, 8, array.length );
|
||||
} else if( array[0] == (byte) 0x83 ) {
|
||||
timestamp = Arrays.copyOfRange( array, 1, 4 );
|
||||
amf = Arrays.copyOfRange( array, 4, array.length );
|
||||
}
|
||||
this.clearC3();
|
||||
}
|
||||
|
||||
public int getPos() {
|
||||
if( type == 0x03 ) {
|
||||
return 12;
|
||||
} else if( type == 0x43 ) {
|
||||
return 8;
|
||||
} else if( type == 0x83 ) {
|
||||
return 4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void clearC3() {
|
||||
try {
|
||||
List<Byte> array = new ArrayList<Byte>();
|
||||
for( int i = 0; i < amf.length; i++ ) {
|
||||
array.add(amf[i]);
|
||||
}
|
||||
int every = 128;
|
||||
|
||||
for( int i = 1; i <= (int) (array.size()/every); i++ ) {
|
||||
if( Util.bytesToHex( new byte[] {array.get(i*every).byteValue()} ).equals(Util.bytesToHex(new byte[] {(byte) 0xC3})) ) {
|
||||
array.remove(i*every);
|
||||
}
|
||||
}
|
||||
|
||||
int j=0;
|
||||
amf = new byte[array.size()];
|
||||
for(Byte b : array)
|
||||
amf[j++] = b.byteValue();
|
||||
} catch( Exception e ) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public int getDecimalLength() {
|
||||
return Integer.parseInt( Util.bytesToHex(this.length), 16 );
|
||||
}
|
||||
|
||||
public byte[] getByteLength() {
|
||||
return this.length;
|
||||
}
|
||||
|
||||
public byte[] getByteTimestamp() {
|
||||
return this.timestamp;
|
||||
}
|
||||
|
||||
public byte[] getByteAMF() {
|
||||
return this.amf;
|
||||
}
|
||||
|
||||
public static int getChunkLength( byte[] nb ) {
|
||||
byte[] length = Arrays.copyOfRange( nb, 4, 7 );
|
||||
int dl = Integer.parseInt( Util.bytesToHex(length), 16 );
|
||||
if( nb[0] == 0x03 ) {
|
||||
return 12 + dl;
|
||||
} else if( nb[0] == 0x43 ) {
|
||||
return 8 + dl;
|
||||
}
|
||||
return nb.length;
|
||||
}
|
||||
|
||||
public static int getChunkLengthW( byte[] nb ) {
|
||||
byte[] length = Arrays.copyOfRange( nb, 4, 7 );
|
||||
int dl = Integer.parseInt( Util.bytesToHex(length), 16 );
|
||||
if( nb[0] == 0x03 ) {
|
||||
return dl;
|
||||
} else if( nb[0] == 0x43 ) {
|
||||
return dl;
|
||||
}
|
||||
return nb.length;
|
||||
}
|
||||
|
||||
public static int getC3( int len ) {
|
||||
int cnt = 0;
|
||||
for( int i = 0; i < len; i++ ) {
|
||||
if( i >= 4095 && ((i+1) % 4096 == 0) && (i+1) < len ) {
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
}
|
230
src/org/cl0zzzy/rtmp/RTMPServer.java
Normal file
230
src/org/cl0zzzy/rtmp/RTMPServer.java
Normal file
@ -0,0 +1,230 @@
|
||||
package org.cl0zzzy.rtmp;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class RTMPServer extends Thread {
|
||||
|
||||
private int port;
|
||||
|
||||
private ArrayList<RTMPListener> clients = new ArrayList<RTMPListener>();
|
||||
|
||||
private boolean exit = false;
|
||||
|
||||
public RTMPServer( int port ) {
|
||||
this.port = port;
|
||||
this.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
System.out.println("RTMP daemon started");
|
||||
ServerSocket serverSocket = new ServerSocket(port);
|
||||
while( !exit ) {
|
||||
RTMPListener listener = new RTMPListener(serverSocket.accept());
|
||||
this.clients.add(listener);
|
||||
listener.start();
|
||||
}
|
||||
serverSocket.close();
|
||||
} catch( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void onOpen( int id ) {}
|
||||
|
||||
public void onClose( int id ) {}
|
||||
|
||||
public ArrayList<AMFObject> onMessage( int id, String function, ArrayList<AMFObject> data ) {
|
||||
return new ArrayList<AMFObject>();
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
this.exit = true;
|
||||
}
|
||||
|
||||
public void broadcast( String function, AMFObject... args ) {
|
||||
for( int i = 0; i < clients.size(); i++ ) {
|
||||
this.call(clients.get(i).id, function, args);
|
||||
}
|
||||
}
|
||||
|
||||
public void call( int id, String function, AMFObject... args ) {
|
||||
try {
|
||||
OutputStream out = null;
|
||||
for( int i = 0; i < clients.size(); i++ ) {
|
||||
if( clients.get(i).id == -1 ) {
|
||||
clients.get(i).sock.close();
|
||||
}
|
||||
if( clients.get(i).id == id ) {
|
||||
out = clients.get(i).out;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( out != null ) {
|
||||
AMFBuilder builder = new AMFBuilder();
|
||||
builder.addAMFObject( new AMFObject( AMFObject.AMF_STRING, function ) );
|
||||
builder.addAMFObject(new AMFObject( AMFObject.AMF_NUMBER, 0.0 ));
|
||||
for( int i = 0; i < args.length; i++ ) {
|
||||
builder.addAMFObject(args[i]);
|
||||
}
|
||||
outWrite(out, builder.build());
|
||||
out.flush();
|
||||
}
|
||||
} catch( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void outWrite(OutputStream out, byte[] b) throws IOException {
|
||||
System.out.println("Packet Sent: " + Util.bytesToHex(b));
|
||||
out.write(b);
|
||||
}
|
||||
|
||||
public void close( int id ) {
|
||||
try {
|
||||
for( int i = 0; i < clients.size(); i++ ) {
|
||||
if( clients.get(i).id == (id) ) {
|
||||
clients.get(i).sock.close();
|
||||
clients.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
onClose( id );
|
||||
} catch( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private class RTMPListener extends Thread {
|
||||
|
||||
private Socket sock;
|
||||
private int id;
|
||||
private InputStream in;
|
||||
private OutputStream out;
|
||||
|
||||
public RTMPListener( Socket sock ) {
|
||||
try {
|
||||
this.sock = sock;
|
||||
this.in = sock.getInputStream();
|
||||
this.out = sock.getOutputStream();
|
||||
} catch( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private int read( byte[] buffer ) throws IOException {
|
||||
int i = in.read(buffer);
|
||||
System.out.println("Packet received ("+i+"): " + Util.bytesToHex(buffer));
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
byte[] buffer = new byte[10000];
|
||||
int cnt = read( buffer );
|
||||
byte[] nb = new byte[cnt];
|
||||
for( int i = 0; i < nb.length; i++ ) {
|
||||
nb[i] = buffer[i];
|
||||
}
|
||||
byte[] hsc1 = Arrays.copyOfRange(nb, 1, nb.length);
|
||||
outWrite(out, new byte[] {0x03});
|
||||
outWrite(out, hsc1);
|
||||
byte[] b = new byte[1536];
|
||||
for( int i = 0; i < b.length; i++ ) {
|
||||
b[i] = (byte) ((Math.random() * 111)+1);
|
||||
}
|
||||
outWrite(out, b);
|
||||
out.flush();
|
||||
in.read(new byte[1536]);
|
||||
while( true ) {
|
||||
buffer = new byte[10000];
|
||||
cnt = read( buffer );
|
||||
nb = new byte[cnt];
|
||||
for( int i = 0; i < nb.length; i++ ) {
|
||||
nb[i] = buffer[i];
|
||||
}
|
||||
while( true ) {
|
||||
if( nb[0] == 0x03 || nb[0] == 0x43 || nb[0] == (byte) 0x83 ) {
|
||||
Chunk c;
|
||||
AMF amf;
|
||||
if( (nb[0] == 0x03 || nb[0] == 0x43) && Chunk.getChunkLength(nb)+Chunk.getC3(Chunk.getChunkLengthW(nb)) > 10000 ) {
|
||||
int c3cnt = Chunk.getC3(Chunk.getChunkLengthW(nb)) - Chunk.getC3(nb.length);
|
||||
int rcnt = Chunk.getChunkLength(nb) - 10000;
|
||||
byte[] __nb = new byte[ c3cnt+rcnt ];
|
||||
read(__nb);
|
||||
byte[] oldNB = nb;
|
||||
nb = new byte[Chunk.getChunkLength(nb)+Chunk.getC3(Chunk.getChunkLengthW(nb))];
|
||||
for( int i = 0; i < oldNB.length; i++ ) {
|
||||
nb[i] = oldNB[i];
|
||||
}
|
||||
for( int i = oldNB.length; i < nb.length; i++ ) {
|
||||
nb[i] = __nb[i-oldNB.length];
|
||||
}
|
||||
}
|
||||
try {
|
||||
c = new Chunk( nb );
|
||||
amf = new AMF( c.getByteAMF() );
|
||||
} catch( Exception e ) {
|
||||
c = new Chunk( nb, true );
|
||||
amf = new AMF( c.getByteAMF() );
|
||||
}
|
||||
if( amf.get(0).getString().equals("connect") ) {
|
||||
this.id = amf.get(3).getInt();
|
||||
outWrite(out, Util.hexStringToByteArray("020000000000040500000000002625A0020000000000050600000000002625A00202000000000004010000000000001000030000000000F214000000000200075F726573756C74003FF0000000000000030006666D7356657202000E464D532F342C302C302C31313231000C6361706162696C697469657300406FE0000000000000046D6F6465003FF00000000000000000090300056C6576656C0200067374617475730004636F646502001D4E6574436F6E6E656374696F6E2E436F6E6E6563742E53756363657373000B6465736372697074696F6E020015436F6E6E656374696F6E207375636365656465642E000E6F626A656374456E636F64696E670000000000000000000004646174610800000000000776657273696F6E02000A342C302C302C31313231000009000009") );
|
||||
out.flush();
|
||||
synchronized(this) {
|
||||
onOpen( this.id );
|
||||
}
|
||||
} else {
|
||||
ArrayList<AMFObject> params = new ArrayList<AMFObject>();
|
||||
for( int i = 2; i < amf.getLength(); i++ ) {
|
||||
params.add(amf.get(i));
|
||||
}
|
||||
synchronized(this) {
|
||||
ArrayList<AMFObject> objs = onMessage(this.id, amf.get(0).getString(), params );
|
||||
if( objs != null ) {
|
||||
AMFBuilder builder = new AMFBuilder();
|
||||
builder.addAMFObject(new AMFObject( AMFObject.AMF_STRING, "_result" ));
|
||||
builder.addAMFObject(new AMFObject( AMFObject.AMF_NUMBER, amf.get(1).getString() ));
|
||||
for( int i = 0; i < objs.size(); i++ ) {
|
||||
builder.addAMFObject(objs.get(i));
|
||||
}
|
||||
outWrite(out, builder.build());
|
||||
out.flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
if( amf.next ) {
|
||||
nb = amf.nextArr;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch( Exception e ) {
|
||||
for( int i = 0; i < clients.size(); i++ ) {
|
||||
if( clients.get(i).id == (this.id) ) {
|
||||
clients.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
synchronized(this) {
|
||||
onClose( this.id );
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
6
src/org/cl0zzzy/rtmp/Result.java
Normal file
6
src/org/cl0zzzy/rtmp/Result.java
Normal file
@ -0,0 +1,6 @@
|
||||
package org.cl0zzzy.rtmp;
|
||||
|
||||
public class Result {
|
||||
public Object val;
|
||||
public int i;
|
||||
}
|
50
src/org/cl0zzzy/rtmp/Util.java
Normal file
50
src/org/cl0zzzy/rtmp/Util.java
Normal file
@ -0,0 +1,50 @@
|
||||
package org.cl0zzzy.rtmp;
|
||||
|
||||
public class Util {
|
||||
|
||||
private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
|
||||
|
||||
public static byte[] hexStringToByteArray(String s) {
|
||||
int len = s.length();
|
||||
byte[] data = new byte[len / 2];
|
||||
for (int i = 0; i < len; i += 2) {
|
||||
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
|
||||
+ Character.digit(s.charAt(i+1), 16));
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public static String bytesToHex(byte[] bytes) {
|
||||
char[] hexChars = new char[bytes.length * 2];
|
||||
for (int j = 0; j < bytes.length; j++) {
|
||||
int v = bytes[j] & 0xFF;
|
||||
hexChars[j * 2] = HEX_ARRAY[v >>> 4];
|
||||
hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
|
||||
}
|
||||
return new String(hexChars);
|
||||
}
|
||||
|
||||
public static int countChunks( byte[] arr ) {
|
||||
int cnt = 0;
|
||||
for( int i = 0; i < arr.length; i++ ) {
|
||||
if( arr[i] == (byte) 0x43 || arr[i] == (byte) 0x83 ) {
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
public static String MD5(String md5) {
|
||||
try {
|
||||
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
|
||||
byte[] array = md.digest(md5.getBytes());
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < array.length; ++i) {
|
||||
sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1,3));
|
||||
}
|
||||
return sb.toString();
|
||||
} catch (java.security.NoSuchAlgorithmException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
35
src/org/cl0zzzy/server/Catalog.java
Normal file
35
src/org/cl0zzzy/server/Catalog.java
Normal file
@ -0,0 +1,35 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.ElementList;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Root(name="catalog")
|
||||
public class Catalog implements ParsableObject {
|
||||
private int CatalogTypeId;
|
||||
private int MediaResourceId;
|
||||
private ArrayList<CatalogItem> items = new ArrayList<CatalogItem>();
|
||||
|
||||
public Catalog(int catalogTypeId, int mediaResourceId, ArrayList<CatalogItem> items) {
|
||||
CatalogTypeId = catalogTypeId;
|
||||
MediaResourceId = mediaResourceId;
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Attribute(name="CatalogTypeId")
|
||||
public int getCatalogTypeId() {
|
||||
return CatalogTypeId;
|
||||
}
|
||||
|
||||
@Attribute(name="MediaResourceId")
|
||||
public int getMediaResourceId() {
|
||||
return MediaResourceId;
|
||||
}
|
||||
|
||||
@ElementList(inline=true, name="item")
|
||||
public ArrayList<CatalogItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
}
|
39
src/org/cl0zzzy/server/CatalogItem.java
Normal file
39
src/org/cl0zzzy/server/CatalogItem.java
Normal file
@ -0,0 +1,39 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
@Root(name="item")
|
||||
public class CatalogItem implements ParsableObject {
|
||||
private int Id;
|
||||
private int TId;
|
||||
private int UsualTickets;
|
||||
private int MagicTickets;
|
||||
|
||||
public CatalogItem(int id, int TId, int usualTickets, int magicTickets) {
|
||||
Id = id;
|
||||
this.TId = TId;
|
||||
UsualTickets = usualTickets;
|
||||
MagicTickets = magicTickets;
|
||||
}
|
||||
|
||||
@Attribute(name="Id")
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
@Attribute(name="TId")
|
||||
public int getTId() {
|
||||
return TId;
|
||||
}
|
||||
|
||||
@Attribute(name="UsualTickets")
|
||||
public int getUsualTickets() {
|
||||
return UsualTickets;
|
||||
}
|
||||
|
||||
@Attribute(name="MagicTickets")
|
||||
public int getMagicTickets() {
|
||||
return MagicTickets;
|
||||
}
|
||||
}
|
39
src/org/cl0zzzy/server/CheckUserRightsObject.java
Normal file
39
src/org/cl0zzzy/server/CheckUserRightsObject.java
Normal file
@ -0,0 +1,39 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
@Root(name="CUR")
|
||||
public class CheckUserRightsObject implements ParsableObject {
|
||||
public boolean IsNotEnoughRole;
|
||||
public boolean IsNotEnoughMoney;
|
||||
public int TextResourceID;
|
||||
public int MediaResourceID;
|
||||
|
||||
public CheckUserRightsObject( boolean IsNotEnoughRole, boolean IsNotEnoughMoney, int TextResourceID, int MediaResourceID ) {
|
||||
this.IsNotEnoughMoney = IsNotEnoughMoney;
|
||||
this.IsNotEnoughRole = IsNotEnoughRole;
|
||||
this.TextResourceID = TextResourceID;
|
||||
this.MediaResourceID = MediaResourceID;
|
||||
}
|
||||
|
||||
@Attribute(name="IsNotEnoughRole")
|
||||
public boolean getIsNotEnoughRole() {
|
||||
return this.IsNotEnoughRole;
|
||||
}
|
||||
|
||||
@Attribute(name="IsNotEnoughMoney")
|
||||
public boolean getIsNotEnoughMoney() {
|
||||
return this.IsNotEnoughMoney;
|
||||
}
|
||||
|
||||
@Attribute(name="TextResourceID")
|
||||
public int getTextResourceID() {
|
||||
return this.TextResourceID;
|
||||
}
|
||||
|
||||
@Attribute(name="MediaResourceID")
|
||||
public int getMediaResourceID() {
|
||||
return this.MediaResourceID;
|
||||
}
|
||||
}
|
74
src/org/cl0zzzy/server/Good.java
Normal file
74
src/org/cl0zzzy/server/Good.java
Normal file
@ -0,0 +1,74 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
@Root(name="good")
|
||||
public class Good implements ParsableObject {
|
||||
private int Id;
|
||||
private int TextResourceID;
|
||||
private int MediaResourceId;
|
||||
private int GoodTypeId;
|
||||
private int RoleFlags;
|
||||
private int UsualTickets;
|
||||
private int MagicTickets;
|
||||
private int IsActive;
|
||||
private int LayerID;
|
||||
|
||||
public Good(int id, int TRId, int MRId, int goodTypeId, int roleFlags, int usualTickets, int magicTickets, int LayerID, int IsActive ) {
|
||||
Id = id;
|
||||
this.TextResourceID = TRId;
|
||||
this.MediaResourceId = MRId;
|
||||
GoodTypeId = goodTypeId;
|
||||
RoleFlags = roleFlags;
|
||||
UsualTickets = usualTickets;
|
||||
MagicTickets = magicTickets;
|
||||
this.IsActive = IsActive;
|
||||
this.LayerID = LayerID;
|
||||
}
|
||||
|
||||
@Attribute(name="IsActive")
|
||||
public int getIsActive() {
|
||||
return IsActive;
|
||||
}
|
||||
|
||||
@Attribute(name="LayerID")
|
||||
public int getLayerID() {
|
||||
return LayerID;
|
||||
}
|
||||
|
||||
@Attribute(name="Id")
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
@Attribute(name="TextResourceId")
|
||||
public int getTextResourceID() {
|
||||
return TextResourceID;
|
||||
}
|
||||
|
||||
@Attribute(name="MediaResourceId")
|
||||
public int getMediaResourceID() {
|
||||
return MediaResourceId;
|
||||
}
|
||||
|
||||
@Attribute(name="GoodTypeId")
|
||||
public int getGoodTypeId() {
|
||||
return GoodTypeId;
|
||||
}
|
||||
|
||||
@Attribute(name="RoleFlags")
|
||||
public int getRoleFlags() {
|
||||
return RoleFlags;
|
||||
}
|
||||
|
||||
@Attribute(name="UsualTickets")
|
||||
public int getUsualTickets() {
|
||||
return UsualTickets;
|
||||
}
|
||||
|
||||
@Attribute(name="MagicTickets")
|
||||
public int getMagicTickets() {
|
||||
return MagicTickets;
|
||||
}
|
||||
}
|
55
src/org/cl0zzzy/server/Inventory.java
Normal file
55
src/org/cl0zzzy/server/Inventory.java
Normal file
@ -0,0 +1,55 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Element;
|
||||
import org.simpleframework.xml.Order;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
@Root(name="user_avatar")
|
||||
@Order(elements = {"Shape", "BodyParts", "Inventory", "Backgrounds", "Phones", "SportInventory"})
|
||||
public class Inventory implements ParsableObject {
|
||||
private InventoryTab shape;
|
||||
private InventoryTab bodyparts;
|
||||
private InventoryTab inventory;
|
||||
private InventoryList backgrounds;
|
||||
private InventoryList phones;
|
||||
private InventoryList sportinv;
|
||||
|
||||
public Inventory( InventoryTab shape, InventoryTab bodyparts, InventoryTab inventory, InventoryList backgrounds, InventoryList phones, InventoryList sportinv ) {
|
||||
this.shape = shape;
|
||||
this.bodyparts = bodyparts;
|
||||
this.inventory = inventory;
|
||||
this.backgrounds = backgrounds;
|
||||
this.phones = phones;
|
||||
this.sportinv = sportinv;
|
||||
}
|
||||
|
||||
@Element(name="Shape")
|
||||
public InventoryTab getShape() {
|
||||
return this.shape;
|
||||
}
|
||||
|
||||
@Element(name="BodyParts")
|
||||
public InventoryTab getBodyParts() {
|
||||
return this.bodyparts;
|
||||
}
|
||||
|
||||
@Element(name="Inventory")
|
||||
public InventoryTab getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Element(name="Backgrounds")
|
||||
public InventoryList getBackgrounds() {
|
||||
return this.backgrounds;
|
||||
}
|
||||
|
||||
@Element(name="Phones")
|
||||
public InventoryList getPhones() {
|
||||
return this.phones;
|
||||
}
|
||||
|
||||
@Element(name="SportInventory")
|
||||
public InventoryList getSportInventory() {
|
||||
return this.sportinv;
|
||||
}
|
||||
}
|
57
src/org/cl0zzzy/server/InventoryGroup.java
Normal file
57
src/org/cl0zzzy/server/InventoryGroup.java
Normal file
@ -0,0 +1,57 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.ElementList;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Root(name="tab")
|
||||
public class InventoryGroup implements ParsableObject {
|
||||
private int ID;
|
||||
private int TextResourceID;
|
||||
private int IsUsed;
|
||||
private int MediaResourceID;
|
||||
private int LayerID;
|
||||
|
||||
private ArrayList<InventoryItem> items = new ArrayList<InventoryItem>();
|
||||
|
||||
public InventoryGroup( int ID, int TextResourceID, int IsUsed, int MediaResourceID, int LayerID, ArrayList<InventoryItem> items ) {
|
||||
this.ID = ID;
|
||||
this.TextResourceID = TextResourceID;
|
||||
this.IsUsed = IsUsed;
|
||||
this.MediaResourceID = MediaResourceID;
|
||||
this.LayerID = LayerID;
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Attribute(name="ID")
|
||||
public int getID() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Attribute(name="TextResourceID")
|
||||
public int getTextResourceID() {
|
||||
return TextResourceID;
|
||||
}
|
||||
|
||||
@Attribute(name="IsUsed")
|
||||
public int getIsUsed() {
|
||||
return IsUsed;
|
||||
}
|
||||
|
||||
@Attribute(name="MediaResourceID")
|
||||
public int getMediaResourceID() {
|
||||
return MediaResourceID;
|
||||
}
|
||||
|
||||
@Attribute(name="LayerID")
|
||||
public int getLayerID() {
|
||||
return LayerID;
|
||||
}
|
||||
|
||||
@ElementList(inline = true, name="item")
|
||||
public ArrayList<InventoryItem> getItems() {
|
||||
return this.items;
|
||||
}
|
||||
}
|
101
src/org/cl0zzzy/server/InventoryItem.java
Normal file
101
src/org/cl0zzzy/server/InventoryItem.java
Normal file
@ -0,0 +1,101 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
@Root(name="item")
|
||||
public class InventoryItem implements ParsableObject {
|
||||
private Integer TextResourceID;
|
||||
private Integer ID;
|
||||
private Integer BodyPartId;
|
||||
private Integer MediaResourceID;
|
||||
private Integer IsUsed;
|
||||
private Integer IsColorable;
|
||||
private Integer Color;
|
||||
private Integer IsLimited;
|
||||
private String Date;
|
||||
private Integer Pollution;
|
||||
private Integer IsBodyPart;
|
||||
|
||||
public InventoryItem( Integer ID, Integer IsLimited, Integer IsUsed, String Date, Integer MediaResourceID, Integer TextResourceID, Integer Pollution, Integer BodyPartId, Integer IsColorable, Integer Color, Integer IsBodyPart ) {
|
||||
this.TextResourceID = TextResourceID;
|
||||
this.BodyPartId = BodyPartId;
|
||||
this.ID = ID;
|
||||
this.Color = Color;
|
||||
this.Date = Date;
|
||||
this.IsBodyPart = IsBodyPart;
|
||||
this.IsColorable = IsColorable;
|
||||
this.IsLimited = IsLimited;
|
||||
this.IsUsed = IsUsed;
|
||||
this.MediaResourceID = MediaResourceID;
|
||||
this.Pollution = Pollution;
|
||||
}
|
||||
|
||||
@Attribute(name="ID")
|
||||
public Integer getID() {
|
||||
return this.ID;
|
||||
}
|
||||
|
||||
@Attribute(name="GoodID")
|
||||
public Integer getGoodID() {
|
||||
return this.ID;
|
||||
}
|
||||
|
||||
@Attribute(name="TextResourceID", required=false)
|
||||
public Integer getTextResourceID() {
|
||||
return TextResourceID;
|
||||
}
|
||||
|
||||
@Attribute(name="BodyPartId")
|
||||
public Integer getBodyPartId() {
|
||||
return BodyPartId;
|
||||
}
|
||||
|
||||
@Attribute(name="MediaResourceID")
|
||||
public Integer getMediaResourceID() {
|
||||
return MediaResourceID;
|
||||
}
|
||||
|
||||
@Attribute(name="IsUsed")
|
||||
public Integer getIsUsed() {
|
||||
return IsUsed;
|
||||
}
|
||||
|
||||
@Attribute(name="IsColorable")
|
||||
public Integer getIsColorable() {
|
||||
return IsColorable;
|
||||
}
|
||||
|
||||
@Attribute(name="Color", required=false)
|
||||
public Integer getColor() {
|
||||
return Color;
|
||||
}
|
||||
|
||||
@Attribute(name="IsLimited", required=false)
|
||||
public Integer getIsLimited() {
|
||||
return IsLimited;
|
||||
}
|
||||
|
||||
@Attribute(name="Date", required=false)
|
||||
public String getDate() {
|
||||
return Date;
|
||||
}
|
||||
|
||||
@Attribute(name="Pollution", required=false)
|
||||
public Integer getPollution() {
|
||||
return Pollution;
|
||||
}
|
||||
|
||||
@Attribute(name="IsBodyPart", required=false)
|
||||
public Integer getIsBodyPart() {
|
||||
return IsBodyPart;
|
||||
}
|
||||
|
||||
public void setIsUsed( int IsUsed ) {
|
||||
this.IsUsed = IsUsed;
|
||||
}
|
||||
|
||||
public void setColor( int color ) {
|
||||
this.Color = color;
|
||||
}
|
||||
}
|
26
src/org/cl0zzzy/server/InventoryList.java
Normal file
26
src/org/cl0zzzy/server/InventoryList.java
Normal file
@ -0,0 +1,26 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.ElementList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class InventoryList implements ParsableObject {
|
||||
private int TextResourceID;
|
||||
private ArrayList<InventoryItem> items = new ArrayList<InventoryItem>();
|
||||
|
||||
public InventoryList( int TextResourceID, ArrayList<InventoryItem> items ) {
|
||||
this.TextResourceID = TextResourceID;
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Attribute(name="TextResourceID")
|
||||
public int getTextResourceID() {
|
||||
return this.TextResourceID;
|
||||
}
|
||||
|
||||
@ElementList(inline = true, name="item")
|
||||
public ArrayList<InventoryItem> getItems() {
|
||||
return this.items;
|
||||
}
|
||||
}
|
26
src/org/cl0zzzy/server/InventoryTab.java
Normal file
26
src/org/cl0zzzy/server/InventoryTab.java
Normal file
@ -0,0 +1,26 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.ElementList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class InventoryTab implements ParsableObject {
|
||||
private int TextResourceID;
|
||||
private ArrayList<InventoryGroup> items = new ArrayList<InventoryGroup>();
|
||||
|
||||
public InventoryTab( int TextResourceID, ArrayList<InventoryGroup> items ) {
|
||||
this.TextResourceID = TextResourceID;
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Attribute(name="TextResourceID")
|
||||
public int getTextResourceID() {
|
||||
return this.TextResourceID;
|
||||
}
|
||||
|
||||
@ElementList(inline = true, name="tab")
|
||||
public ArrayList<InventoryGroup> getItems() {
|
||||
return this.items;
|
||||
}
|
||||
}
|
32
src/org/cl0zzzy/server/MagicAbility.java
Normal file
32
src/org/cl0zzzy/server/MagicAbility.java
Normal file
@ -0,0 +1,32 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
@Root(name="ability")
|
||||
public class MagicAbility {
|
||||
private int Id;
|
||||
private String ExpirationDate;
|
||||
private int IsLimited;
|
||||
|
||||
public MagicAbility(int id, String expirationDate, int isLimited) {
|
||||
Id = id;
|
||||
ExpirationDate = expirationDate;
|
||||
IsLimited = isLimited;
|
||||
}
|
||||
|
||||
@Attribute(name="Id")
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
@Attribute(name="ExpirationDate")
|
||||
public String getExpirationDate() {
|
||||
return ExpirationDate;
|
||||
}
|
||||
|
||||
@Attribute(name="IsLimited")
|
||||
public int getIsLimited() {
|
||||
return IsLimited;
|
||||
}
|
||||
}
|
7
src/org/cl0zzzy/server/Main.java
Normal file
7
src/org/cl0zzzy/server/Main.java
Normal file
@ -0,0 +1,7 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
new Server(9115, 8888);
|
||||
}
|
||||
}
|
3
src/org/cl0zzzy/server/ParsableObject.java
Normal file
3
src/org/cl0zzzy/server/ParsableObject.java
Normal file
@ -0,0 +1,3 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
public interface ParsableObject {}
|
92
src/org/cl0zzzy/server/Player.java
Normal file
92
src/org/cl0zzzy/server/Player.java
Normal file
@ -0,0 +1,92 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
public class Player {
|
||||
|
||||
private int id = -1;
|
||||
private String playerName = "";
|
||||
private double x = 480;
|
||||
private double y = 300;
|
||||
private double state = 2;
|
||||
private int location = Integer.MAX_VALUE;
|
||||
private boolean inLocation = false;
|
||||
private boolean inMultiplayerGame = false;
|
||||
private boolean canModifyLocations = false;
|
||||
|
||||
public Player( int id ) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setX( double x ) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public void setY( double y ) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public void setCanModifyLocations( boolean canModifyLocations ) {
|
||||
this.canModifyLocations = canModifyLocations;
|
||||
}
|
||||
|
||||
public boolean getCanModifyLocations() {
|
||||
return this.canModifyLocations;
|
||||
}
|
||||
|
||||
public void setCoords( double x, double y ) {
|
||||
this.setX(x);
|
||||
this.setY(y);
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public void setLocation( int id ) {
|
||||
this.location = id;
|
||||
}
|
||||
|
||||
public int getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
public void setState( double state ) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public double getState() {
|
||||
return this.state;
|
||||
}
|
||||
|
||||
public void setInMultiplayerGame( boolean inMultiplayerGame ) {
|
||||
this.inMultiplayerGame = inMultiplayerGame;
|
||||
}
|
||||
|
||||
public boolean IsInMultiplayerGame() {
|
||||
return this.inMultiplayerGame;
|
||||
}
|
||||
|
||||
public void setInLocation( boolean inLocation ) {
|
||||
this.inLocation = inLocation;
|
||||
}
|
||||
|
||||
public boolean isInLocation() {
|
||||
return this.inLocation;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setName( String name ) {
|
||||
this.playerName = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.playerName;
|
||||
}
|
||||
|
||||
}
|
24
src/org/cl0zzzy/server/Profile.java
Normal file
24
src/org/cl0zzzy/server/Profile.java
Normal file
@ -0,0 +1,24 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.Element;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
@Root(name="inventory")
|
||||
public class Profile implements ParsableObject {
|
||||
private UserInfo ui;
|
||||
|
||||
public Profile( UserInfo ui ) {
|
||||
this.ui = ui;
|
||||
}
|
||||
|
||||
@Element(name="user")
|
||||
public UserInfo getUserInfo() {
|
||||
return this.ui;
|
||||
}
|
||||
|
||||
@Element(name="avatar")
|
||||
public String getAvatar() {
|
||||
return "";
|
||||
}
|
||||
}
|
811
src/org/cl0zzzy/server/Server.java
Normal file
811
src/org/cl0zzzy/server/Server.java
Normal file
@ -0,0 +1,811 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.cl0zzzy.http.HttpMain;
|
||||
import org.cl0zzzy.sqlite.DB;
|
||||
import org.cl0zzzy.rtmp.AMFEcmaArray;
|
||||
import org.cl0zzzy.rtmp.AMFObject;
|
||||
import org.cl0zzzy.rtmp.AMFObjectArray;
|
||||
import org.cl0zzzy.rtmp.RTMPServer;
|
||||
import org.simpleframework.xml.Serializer;
|
||||
import org.simpleframework.xml.core.Persister;
|
||||
|
||||
public class Server extends RTMPServer {
|
||||
|
||||
private final Base Base = new Base();
|
||||
private final Avatar Avatar = new Avatar();
|
||||
private final Location Location = new Location();
|
||||
private final Home Home = new Home();
|
||||
|
||||
private ArrayList<Player> players = new ArrayList<Player>();
|
||||
|
||||
private HttpMain HTTP;
|
||||
|
||||
private String toXML( ParsableObject c ) {
|
||||
Writer writer = new StringWriter();
|
||||
Serializer serializer = new Persister();
|
||||
try {
|
||||
serializer.write(c, writer);
|
||||
return writer.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "<x/>";
|
||||
}
|
||||
|
||||
public Server(int port, int httpPort) {
|
||||
super(port);
|
||||
org.cl0zzzy.sqlite.DB.connect();
|
||||
this.HTTP = new HttpMain(httpPort, port);
|
||||
}
|
||||
|
||||
private Player getPlayerById( int id ) {
|
||||
for( int i = 0; i < players.size(); i++ ) {
|
||||
if( players.get(i).getId() == id ) {
|
||||
return players.get(i);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void sendInLoc( int location, String function, AMFObject... args ) {
|
||||
for( int i = 0; i < players.size(); i++ ) {
|
||||
if( players.get(i).getLocation() == (location) && players.get(i).isInLocation() ) {
|
||||
this.call(players.get(i).getId(), function, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onOpen( int id ) {
|
||||
System.out.println( "connection " + id );
|
||||
Player p = new Player(id);
|
||||
players.add(p);
|
||||
HTTP.updatePlayers( players.size() );
|
||||
DB.clearMagicAbilities( id );
|
||||
}
|
||||
|
||||
public ArrayList<AMFObject> onMessage( int id, String function, ArrayList<AMFObject> data ) {
|
||||
ArrayList<AMFObject> result = new ArrayList<AMFObject>();
|
||||
|
||||
if( !function.equals("_LG") && !function.equals("_S") && !data.get(1).getString().equals("_SR") && !function.equals("_SR") && !function.equals("_P") ) {
|
||||
System.out.println( "onMessage " + id + " " + function + " " + data.get(1).getString());
|
||||
|
||||
for( int i = 0; i < data.size(); i++ ) {
|
||||
System.out.println( i + " " + data.get(i).getString() );
|
||||
}
|
||||
}
|
||||
|
||||
if( function.equals("_S") ) {
|
||||
Base.setState( id, data.get(1).getString() );
|
||||
} else if( function.equals("_P") ) {
|
||||
Base.setPosition( id, data.get(1), data.get(2).getDouble() );
|
||||
} else if( function.equals("$") ) {
|
||||
if( data.get(1).getString().equals("_I") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
System.out.println(Avatar.getUserInitData( this.getPlayerById(id) ) );
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, Avatar.getUserInitData( this.getPlayerById(id) ) ));
|
||||
} else if( data.get(1).getString().equals("_MC") ) {
|
||||
int recieverId = data.get(4).getECMArray().getValueAt(0).getInt();
|
||||
String cardId = data.get(4).getECMArray().getValueAt(1).getString();
|
||||
String pcid = DB.sendPostcard( id, recieverId, cardId );
|
||||
call( recieverId, "_MC", new AMFObject(AMFObject.AMF_NULL, null), new AMFObject(AMFObject.AMF_STRING, "<postcard><item Id=\""+pcid+"\" DateSent=\"\" SenderId=\""+id+"\" SenderName=\""+this.getPlayerById(id).getName()+"\" CardId=\""+cardId+"\" IsNew=\"1\" /></postcard>") );
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null));
|
||||
} else if( data.get(1).getString().equals("_MP") ) {
|
||||
int recieverId = data.get(4).getECMArray().getValueAt(0).getInt();
|
||||
String message = data.get(4).getECMArray().getValueAt(1).getString();
|
||||
String msgId = DB.sendPhoneMessage( id, recieverId, message );
|
||||
call( recieverId, "_MP", new AMFObject(AMFObject.AMF_NULL, null),
|
||||
new AMFObject(AMFObject.AMF_STRING, "<item Id=\""+msgId+"\" DateSent=\"\" SenderId=\""+id+"\" SenderName=\""+this.getPlayerById(id).getName()+"\" Text=\""+message+"\" IsNew=\"1\" />") );
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null));
|
||||
} else if( data.get(1).getString().equals("_MCD") ) {
|
||||
DB.removePostcard(data.get(4).getECMArray().getValueAt(0).getString());
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null));
|
||||
} else if( data.get(1).getString().equals("_MCR") ) {
|
||||
DB.markPostcardAsRead( data.get(4).getECMArray().getValueAt(0).getString() );
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null));
|
||||
} else if( data.get(1).getString().equals("_MPR") ) {
|
||||
DB.markMessageAsRead( data.get(4).getECMArray().getValueAt(0).getString() );
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null));
|
||||
} else if( data.get(1).getString().equals("_SNFP") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "" ));
|
||||
} else if( data.get(1).getString().equals("_D") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
} else if( data.get(1).getString().equals("_CM") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "</clubmap>" ));
|
||||
} else if( data.get(1).getString().equals("_LDH") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "<root><inventory>"+DB.getFurnitureFromInventory(id)+"</inventory><locations><item ID=\"112\" MediaResourceID=\"1399\" IsHome=\"1\" IsCurrent=\"1\" IsLocked=\"1\" />"+DB.getHousesFromInventory(id)+"</locations></root>" ));
|
||||
} else if( data.get(1).getString().equals("_LG") ) {
|
||||
if( data.get(4).getECMArray().getValueAt(1).getDouble() == -1.0 ) {
|
||||
int owner = data.get(4).getECMArray().getValueAt(0).getInt();
|
||||
result = Home.getHome(result, owner, id);
|
||||
} else if( data.get(4).getECMArray().getValueAt(1).getDouble() == -2.0 ) {
|
||||
|
||||
} else {
|
||||
result = Location.getLocation( this.getPlayerById(id), data.get(4).getECMArray().getValueAt(1).getDouble(), data.get(4).getECMArray().getValueAt(2).getDouble());
|
||||
this.getPlayerById(id).setX(Double.parseDouble(Location.getLocationX(data.get(4).getECMArray().getValueAt(1).getDouble(), data.get(4).getECMArray().getValueAt(2).getDouble())));
|
||||
this.getPlayerById(id).setY(Double.parseDouble(Location.getLocationY(data.get(4).getECMArray().getValueAt(1).getDouble(), data.get(4).getECMArray().getValueAt(2).getDouble())));
|
||||
Base.updateLocationPlayers(id, Location.getLocationId(data.get(4).getECMArray().getValueAt(1).getDouble(), data.get(4).getECMArray().getValueAt(2).getDouble()));
|
||||
}
|
||||
} else if( data.get(1).getString().equals("_LGI") ) {
|
||||
double nextLocation = data.get(4).getECMArray().getValueAt(0).getDouble();
|
||||
double prevLocation = data.get(4).getECMArray().getValueAt(1).getDouble();
|
||||
if( nextLocation == -1.0 ) {
|
||||
nextLocation = 0;
|
||||
prevLocation = 0;
|
||||
}
|
||||
result = Location.getLocation( this.getPlayerById(id), nextLocation, prevLocation);
|
||||
this.getPlayerById(id).setX(Double.parseDouble(Location.getLocationX(nextLocation, prevLocation)));
|
||||
this.getPlayerById(id).setY(Double.parseDouble(Location.getLocationY(nextLocation, prevLocation)));
|
||||
Base.updateLocationPlayers(id, Location.getLocationId(nextLocation, prevLocation));
|
||||
} else if( data.get(1).getString().equals("_UFG") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_OBJECT_START, DB.getUserFriends( id, players ) ));
|
||||
} else if( data.get(1).getString().equals("_UFR") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_OBJECT_START, DB.getUserFriendsRequests( id, players ) ));
|
||||
} else if( data.get(1).getString().equals("_UFO") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_OBJECT_START, DB.getUserFriends( id, players ) ));
|
||||
} else if( data.get(1).getString().equals("_UFA") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "" ));
|
||||
String[] uids = new String[1];
|
||||
if( !data.get(4).getECMArray().getValueAt(1).getString().equals("") ) {
|
||||
uids = data.get(4).getECMArray().getValueAt(1).getString().split(",");
|
||||
for( int k = 0; k < uids.length; k++ ) {
|
||||
DB.removeFriend( id, Integer.parseInt(uids[k]) );
|
||||
}
|
||||
} else {
|
||||
uids = data.get(4).getECMArray().getValueAt(0).getString().split(",");
|
||||
for( int k = 0; k < uids.length; k++ ) {
|
||||
DB.addFriend( id, Integer.parseInt(uids[k]) );
|
||||
|
||||
AMFObjectArray array = new AMFObjectArray();
|
||||
AMFObjectArray player = new AMFObjectArray();
|
||||
player.add("UserName", new AMFObject( AMFObject.AMF_STRING, DB.getPlayerName(Integer.parseInt(uids[k])) ));
|
||||
player.add("UserId", new AMFObject( AMFObject.AMF_STRING, uids[k] ));
|
||||
player.add("SnName", new AMFObject( AMFObject.AMF_STRING, "" ));
|
||||
boolean is = false;
|
||||
for( int i = 0; i < players.size(); i++ ) {
|
||||
if( players.get(i).getId() == Integer.parseInt(uids[k]) ) {
|
||||
is = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( is ) {
|
||||
player.add("IsOnline", new AMFObject( AMFObject.AMF_STRING, "1" ) );
|
||||
} else {
|
||||
player.add("IsOnline", new AMFObject( AMFObject.AMF_STRING, "0" ) );
|
||||
}
|
||||
array.add("1", new AMFObject( AMFObject.AMF_OBJECT_START, player ));
|
||||
|
||||
call( id, "_UFLA", new AMFObject( AMFObject.AMF_NULL, null ),
|
||||
new AMFObject( AMFObject.AMF_OBJECT_START, array ) );
|
||||
|
||||
array = new AMFObjectArray();
|
||||
player = new AMFObjectArray();
|
||||
player.add("UserName", new AMFObject( AMFObject.AMF_STRING, this.getPlayerById(id).getName() ));
|
||||
player.add("UserId", new AMFObject( AMFObject.AMF_STRING, id ));
|
||||
player.add("SnName", new AMFObject( AMFObject.AMF_STRING, "" ));
|
||||
is = false;
|
||||
for( int i = 0; i < players.size(); i++ ) {
|
||||
if( players.get(i).getId() == id ) {
|
||||
is = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( is ) {
|
||||
player.add("IsOnline", new AMFObject( AMFObject.AMF_STRING, "1" ) );
|
||||
} else {
|
||||
player.add("IsOnline", new AMFObject( AMFObject.AMF_STRING, "0" ) );
|
||||
}
|
||||
array.add("1", new AMFObject( AMFObject.AMF_OBJECT_START, player ));
|
||||
|
||||
call( Integer.parseInt(uids[k]), "_UFLA", new AMFObject( AMFObject.AMF_NULL, null ),
|
||||
new AMFObject( AMFObject.AMF_OBJECT_START, array ) );
|
||||
}
|
||||
}
|
||||
} else if( data.get(1).getString().equals("_UFD") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "" ));
|
||||
DB.removeFriend( id, data.get(4).getECMArray().getValueAt(0).getInt() );
|
||||
} else if( data.get(1).getString().equals("_NUM") ) {
|
||||
Base.useMagicAbility( data.get(4).getECMArray().getValueAt(0).getInt(), data.get(4).getECMArray().getValueAt(1).getDouble() );
|
||||
} else if( data.get(1).getString().equals("_NUS") ) {
|
||||
if( data.get(2).getString().equals("ROOM") ) {
|
||||
Base.throwSnowball( data.get(4).getECMArray().getValueAt(0).getInt(), data.get(4).getECMArray().getValueAt(1).getDouble(), data.get(4).getECMArray().getValueAt(2).getDouble() );
|
||||
}
|
||||
} else if( data.get(1).getString().equals("_C") ) {
|
||||
if( data.get(4).getECMArray().getValueAt(1).getString().startsWith("/give ") ) {
|
||||
try {
|
||||
DB.addPlayerCloth(id, Integer.parseInt(data.get(4).getECMArray().getValueAt(1).getString().substring(6)) + "");
|
||||
} catch( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Base.chatMessage( id, data.get(4).getECMArray().getValueAt(1).getString() );
|
||||
} else if( data.get(1).getString().equals("_UUG") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "123" ));
|
||||
} else if( data.get(1).getString().equals("_GG") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, DB.getGameXML(data.get(4).getECMArray().getValueAt(0).getString()) ));
|
||||
System.out.println( DB.getGameXML(data.get(4).getECMArray().getValueAt(0).getString()) );
|
||||
} else if( data.get(1).getString().equals("_GC") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "0" ));
|
||||
getPlayerById(id).setInLocation(true);
|
||||
} else if( data.get(1).getString().equals("_GD") ) {
|
||||
this.getPlayerById(id).setInMultiplayerGame(false);
|
||||
} else if( data.get(1).getString().equals("_GR") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
|
||||
this.getPlayerById(id).setInMultiplayerGame(true);
|
||||
|
||||
AMFObjectArray array = new AMFObjectArray();
|
||||
array.add("ID", new AMFObject( AMFObject.AMF_STRING, id ));
|
||||
array.add("Name", new AMFObject( AMFObject.AMF_STRING, this.getPlayerById(id).getName() ));
|
||||
|
||||
AMFObjectArray ecma = new AMFObjectArray();
|
||||
ecma.add("0", new AMFObject(AMFObject.AMF_OBJECT_START, array));
|
||||
|
||||
array = new AMFObjectArray();
|
||||
array.add("ID", new AMFObject( AMFObject.AMF_STRING, "2" ));
|
||||
array.add("Name", new AMFObject( AMFObject.AMF_STRING, "Натик" ));
|
||||
|
||||
ecma.add("1", new AMFObject(AMFObject.AMF_OBJECT_START, array));
|
||||
|
||||
AMFObjectArray _arr = new AMFObjectArray();
|
||||
_arr.add("0", new AMFObject(AMFObject.AMF_OBJECT_START, ecma));
|
||||
|
||||
new Thread( () -> { try { Thread.sleep(2000); } catch( Exception e ) { e.printStackTrace(); } call( id, "_GU", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_OBJECT_START, _arr ),
|
||||
new AMFObject( AMFObject.AMF_NUMBER, 1 ), new AMFObject( AMFObject.AMF_BOOLEAN, false ) ); } ).start();
|
||||
|
||||
new Thread( () -> { try { Thread.sleep(2500); } catch( Exception e ) { e.printStackTrace(); } call( id, "_GL", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_OBJECT_START, _arr ),
|
||||
new AMFObject( AMFObject.AMF_STRING, "222" )); } ).start();
|
||||
|
||||
new Thread( () -> {
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
int i = 0;
|
||||
while( i < 100 ) {
|
||||
call(id, "_G", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_STRING, "OnReady" ), new AMFObject( AMFObject.AMF_NUMBER, 0 ), new AMFObject( AMFObject.AMF_STRING, id ));
|
||||
i++;
|
||||
Thread.sleep(500);
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
} else if( data.get(1).getString().equals("_GT") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "0" ));
|
||||
} else if( data.get(1).getString().equals("_GS") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
Base.setMoney(id, DB.getPlayerUsualTickets(id)+data.get(4).getECMArray().getValueAt(1).getInt(), DB.getPlayerMagicTickets(id));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "" ));
|
||||
} else if( data.get(1).getString().equals("_AG") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, Avatar.getAG(id) ));
|
||||
} else if( data.get(1).getString().equals("_AS") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
Avatar.setAG(id, data.get(4).getECMArray());
|
||||
result.add(new AMFObject( AMFObject.AMF_ECMA_ARRAY_START, new AMFEcmaArray() ));
|
||||
this.sendInLoc(this.getPlayerById(id).getLocation(), "_UL", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_STRING, id ));
|
||||
this.sendInLoc(this.getPlayerById(id).getLocation(), "_UE", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_STRING, id ), new AMFObject( AMFObject.AMF_OBJECT_START, Avatar.getUE(id) ) );
|
||||
} else if( data.get(1).getString().equals("_UI") ) {
|
||||
AMFObjectArray friends = DB.getUserFriends(id, players);
|
||||
String isFriend = "0";
|
||||
for( int i = 0; i < friends.getLength(); i++ ) {
|
||||
String user = friends.getValueAt(i).getObjectArray().get("UserId").getString();
|
||||
String uid = String.valueOf(((int)Double.parseDouble(data.get(4).getECMArray().getValueAt(0).getString())));
|
||||
if( uid.equals(user) ) {
|
||||
isFriend = "1";
|
||||
break;
|
||||
}
|
||||
}
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, Avatar.getUI(data.get(4).getECMArray().getValueAt(0).getInt(), isFriend) ));
|
||||
} else if( data.get(1).getString().equals("_GCI") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, this.toXML(DB.getCatalogById(data.get(4).getECMArray().getValueAt(0).getString())) ));
|
||||
} else if( data.get(1).getString().equals("_JD") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "<garage><Car><item Id=\"8156304\" CarTypeId=\"1\" MediaResourceID=\"2135\" IsCurrent=\"1\" /></Car><Inventory><item Id=\"75\" TypeId=\"75\" CarTypeId=\"1\" MediaResourceID=\"2235\"><item Id=\"59497575\" UserCarId=\"8156304\" /></item><item Id=\"76\" TypeId=\"77\" CarTypeId=\"1\" MediaResourceID=\"2131\"><item Id=\"59497576\" UserCarId=\"8156304\" /></item><item Id=\"77\" TypeId=\"72\" CarTypeId=\"1\" MediaResourceID=\"2127\"><item Id=\"59497577\" UserCarId=\"8156304\" /></item><item Id=\"78\" TypeId=\"74\" CarTypeId=\"1\" MediaResourceID=\"2236\"><item Id=\"59497578\" UserCarId=\"8156304\" /></item><item Id=\"79\" TypeId=\"73\" CarTypeId=\"1\" MediaResourceID=\"2237\"><item Id=\"59497579\" UserCarId=\"8156304\" /></item><item Id=\"80\" TypeId=\"76\" CarTypeId=\"1\" MediaResourceID=\"2238\"><item Id=\"59497580\" UserCarId=\"8156304\" /></item><item Id=\"81\" TypeId=\"81\" CarTypeId=\"1\" MediaResourceID=\"2239\"><item Id=\"59497581\" UserCarId=\"8156304\" /></item></Inventory></garage>"));
|
||||
} else if( data.get(1).getString().equals("_VC") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_BOOLEAN, true ));
|
||||
} else if( data.get(1).getString().equals("_BGB") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
AMFObjectArray good = data.get(4).getECMArray().getValueAt(0).getECMArray().getValueAt(0).getObjectArray().get("item").getObjectArray();
|
||||
if( good.get("priceSm").getDouble() <= DB.getPlayerUsualTickets(id) &&
|
||||
good.get("priceRu").getDouble() <= DB.getPlayerMagicTickets(id) ) {
|
||||
AMFObjectArray tags = good.get("tagsHash").getObjectArray();
|
||||
if( tags.get("cloth") != null || tags.get("costume") != null || tags.get("back") != null ) {
|
||||
DB.addPlayerCloth( id, good.get("id").getString() );
|
||||
} else if( tags.get("magic") != null ) {
|
||||
if( good.get("magicAbilityTime").getString().equals("null") ) {
|
||||
DB.addMagicAbility(id, good.get("magicAbilityId").getString(), "0", "0");
|
||||
} else {
|
||||
DB.addMagicAbility(id, good.get("magicAbilityId").getString(), good.get("magicAbilityTime").getString(), "1");
|
||||
}
|
||||
} else if( tags.get("furniture") != null ) {
|
||||
DB.addPlayerFurniture( id, good.get("id").getString() );
|
||||
} else if( tags.get("house") != null ) {
|
||||
DB.addPlayerHome( id, good.get("id").getString() );
|
||||
} else {
|
||||
//System.out.println( "cloth == null" );
|
||||
//System.out.println( tags.toString() );
|
||||
}
|
||||
Base.setMoney(id, DB.getPlayerUsualTickets(id)-good.get("priceSm").getInt(), DB.getPlayerMagicTickets(id)-good.get("priceRu").getInt());
|
||||
AMFObjectArray arr = new AMFObjectArray();
|
||||
arr.add("Error", new AMFObject( AMFObject.AMF_BOOLEAN, false ));
|
||||
arr.add("GoodInfo", new AMFObject( AMFObject.AMF_ECMA_ARRAY_START, new AMFEcmaArray() ));
|
||||
result.add(new AMFObject( AMFObject.AMF_OBJECT_START, arr ));
|
||||
} else {
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "0" ) );
|
||||
}
|
||||
} else if( data.get(1).getString().equals("_UFQ") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "" ));
|
||||
AMFObjectArray player = new AMFObjectArray();
|
||||
player.add("UserName", new AMFObject( AMFObject.AMF_STRING, DB.getPlayerName(id) ));
|
||||
player.add("UserId", new AMFObject( AMFObject.AMF_STRING, id ));
|
||||
player.add("SnName", new AMFObject( AMFObject.AMF_STRING, "" ));
|
||||
player.add("IsOnline", new AMFObject( AMFObject.AMF_STRING, "1" ) );
|
||||
|
||||
call(data.get(4).getECMArray().getValueAt(0).getInt(), "_UFLR",
|
||||
new AMFObject( AMFObject.AMF_NULL, null ),
|
||||
new AMFObject( AMFObject.AMF_OBJECT_START, player));
|
||||
DB.requestFriend(id, data.get(4).getECMArray().getValueAt(0).getInt());
|
||||
} else if( data.get(1).getString().equals("_LM") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, DB.getUserMagicAbilities(id) ));
|
||||
} else if( data.get(1).getString().equals("_GMB") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
AMFObjectArray array = new AMFObjectArray();
|
||||
array.add("Amount", new AMFObject( AMFObject.AMF_NUMBER, 9999 ));
|
||||
result.add(new AMFObject( AMFObject.AMF_OBJECT_START, array ));
|
||||
} else if( data.get(1).getString().equals("_MTB") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
AMFObjectArray array = new AMFObjectArray();
|
||||
array.add("Amount", new AMFObject( AMFObject.AMF_NUMBER, 9999 ));
|
||||
array.add("Success", new AMFObject( AMFObject.AMF_NUMBER, 1 ));
|
||||
result.add(new AMFObject( AMFObject.AMF_OBJECT_START, array ));
|
||||
Base.setMoney(id, DB.getPlayerUsualTickets(id),DB.getPlayerMagicTickets(id)+100);
|
||||
} else if( data.get(1).getString().equals("_TE") ) {
|
||||
int magic_rem = 0;
|
||||
int usual_add = 0;
|
||||
if( data.get(4).getECMArray().getValueAt(0).getDouble() == 1.0 ) {
|
||||
magic_rem = 2;
|
||||
usual_add = 100;
|
||||
} else if( data.get(4).getECMArray().getValueAt(0).getDouble() == 2.0 ) {
|
||||
magic_rem = 4;
|
||||
usual_add = 200;
|
||||
} else if( data.get(4).getECMArray().getValueAt(0).getDouble() == 3.0 ) {
|
||||
magic_rem = 10;
|
||||
usual_add = 500;
|
||||
} else if( data.get(4).getECMArray().getValueAt(0).getDouble() == 4.0 ) {
|
||||
magic_rem = 20;
|
||||
usual_add = 1000;
|
||||
} else if( data.get(4).getECMArray().getValueAt(0).getDouble() == 5.0 ) {
|
||||
magic_rem = 50;
|
||||
usual_add = 2500;
|
||||
}
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
AMFObjectArray array = new AMFObjectArray();
|
||||
array.add("Success", new AMFObject( AMFObject.AMF_NUMBER, 1 ));
|
||||
result.add(new AMFObject( AMFObject.AMF_OBJECT_START, array ));
|
||||
Base.setMoney(id, DB.getPlayerUsualTickets(id)+usual_add, DB.getPlayerMagicTickets(id)-magic_rem);
|
||||
} else if( data.get(1).getString().equals("_LC") ) {
|
||||
if( data.get(2).getString().equals("ROOM") ) {
|
||||
String type = data.get(4).getECMArray().getValueAt(1).getString();
|
||||
if( type.equals("-1.0") ) {
|
||||
AMFObjectArray object = data.get(4).getECMArray().getValueAt(2).getObjectArray();
|
||||
AMFObjectArray Add = object.get("Add").getObjectArray();
|
||||
AMFObjectArray Remove = object.get("Remove").getObjectArray();
|
||||
//System.out.println("Add + " + Add.toString());
|
||||
String xml = "";
|
||||
for( int i = 0; i < Add.getLength(); i++ ) {
|
||||
String key = Add.getKeyAt(i);
|
||||
AMFObjectArray oa = Add.get(key).getObjectArray();
|
||||
xml += "<f ";
|
||||
for( int u = 0; u < oa.getLength(); u++ ) {
|
||||
xml += oa.getKeyAt(u) + "=\""+oa.getValueAt(u)+"\" ";
|
||||
}
|
||||
xml += "/>";
|
||||
}
|
||||
//System.out.println( xml );
|
||||
//System.out.println("Remove + " + Remove.toString());
|
||||
}
|
||||
}
|
||||
} else if( data.get(1).getString().equals("_CUR") ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ) );
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, this.toXML(new CheckUserRightsObject(false, false, DB.getGoodById((int) data.get(4).getECMArray().getValueAt(0).getDouble()).getTextResourceID(), DB.getGoodById((int) data.get(4).getECMArray().getValueAt(0).getDouble()).getMediaResourceID())) ));
|
||||
}
|
||||
} else if( function.equals("_LS") ) {
|
||||
if( data.get(1).getString().startsWith("G$") ) {
|
||||
getPlayerById(id).setInLocation(false);
|
||||
Base.deleteSelf(id, this.getPlayerById(id).getLocation());
|
||||
} else {
|
||||
if( this.getPlayerById(id).isInLocation() ) {
|
||||
Base.updateLocationPlayers(id, this.getPlayerById(id).getLocation());
|
||||
sendInLoc(this.getPlayerById(id).getLocation(), "_UE", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_STRING, id ), new AMFObject( AMFObject.AMF_OBJECT_START, Avatar.getUE(id) ));
|
||||
}
|
||||
}
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "" ));
|
||||
} else if( function.equals("_LG") ) {
|
||||
|
||||
//System.out.println( " data " );
|
||||
|
||||
/*for( AMFObject d : data ) {
|
||||
System.out.println( d.toString() );
|
||||
}*/
|
||||
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "222" ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, data.get(1).getString() ));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void onClose( int id ) {
|
||||
System.out.println( "onClose " + id );
|
||||
for( int i = 0; i < players.size(); i++ ) {
|
||||
if( players.get(i).getId() == id ) {
|
||||
this.broadcast("_UL", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_STRING, id ));
|
||||
this.players.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
HTTP.updatePlayers( players.size() );
|
||||
}
|
||||
|
||||
private class Base {
|
||||
|
||||
private class stateThread extends Thread {
|
||||
|
||||
private int id;
|
||||
private Player p;
|
||||
|
||||
public stateThread( int id, Player p ) {
|
||||
this.p = p;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try { Thread.sleep(800); } catch( Exception e ) { e.printStackTrace(); }
|
||||
setState( p.getId(), String.valueOf( p.getState() ), id );
|
||||
}
|
||||
}
|
||||
|
||||
public void setMoney( int id, int usual, int magic ) {
|
||||
call( id, "_NNT", new AMFObject( AMFObject.AMF_NULL, null ),
|
||||
new AMFObject(AMFObject.AMF_NUMBER, usual),
|
||||
new AMFObject(AMFObject.AMF_NUMBER, magic ) );
|
||||
DB.updateMoney( id, usual, magic );
|
||||
}
|
||||
|
||||
private void setState( int id, String state, int sendId ) {
|
||||
Player p = getPlayerById(id);
|
||||
getPlayerById(id).setState(Double.parseDouble( state ));
|
||||
if( p.isInLocation() ) {
|
||||
call( sendId, "_S", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_STRING, id ), new AMFObject( AMFObject.AMF_NUMBER, state ));
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteSelf( int id, int location ) {
|
||||
sendInLoc( location, "_UL", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_STRING, id ) );
|
||||
}
|
||||
|
||||
private void sendSelf( int id, int location ) {
|
||||
sendInLoc( location, "_UE",
|
||||
new AMFObject( AMFObject.AMF_NULL, null ),
|
||||
new AMFObject( AMFObject.AMF_STRING, id ),
|
||||
new AMFObject( AMFObject.AMF_OBJECT_START, Avatar.getUE(id)));
|
||||
}
|
||||
|
||||
public void updateLocationPlayers( int id, int location ) {
|
||||
if( location != getPlayerById(id).getLocation() ) {
|
||||
this.deleteSelf(id, getPlayerById(id).getLocation());
|
||||
for( Player p : players ) {
|
||||
if( p.getLocation() == getPlayerById(id).getLocation() ) {
|
||||
call( id, "_UL", new AMFObject( AMFObject.AMF_NULL, null ),
|
||||
new AMFObject( AMFObject.AMF_STRING, p.getId() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
getPlayerById(id).setInLocation(true);
|
||||
getPlayerById(id).setLocation(location);
|
||||
this.sendSelf(id, location);
|
||||
call( id, "_UE", new AMFObject( AMFObject.AMF_NULL, null ),
|
||||
new AMFObject( AMFObject.AMF_STRING, id ),
|
||||
new AMFObject( AMFObject.AMF_OBJECT_START, Avatar.getUE(id) ));
|
||||
for( Player p : players ) {
|
||||
if( p.getId() != id && p.getLocation() == location && p.isInLocation() ) {
|
||||
call( id, "_UE", new AMFObject( AMFObject.AMF_NULL, null ),
|
||||
new AMFObject( AMFObject.AMF_STRING, p.getId() ),
|
||||
new AMFObject( AMFObject.AMF_OBJECT_START, Avatar.getUE(p.getId()) ));
|
||||
new stateThread( id, p ).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setPosition( int id, AMFObject obj, double num ) {
|
||||
AMFObjectArray arr = new AMFObjectArray();
|
||||
if( obj.getObjectArray() != null ) {
|
||||
arr.add("x", obj.getObjectArray().get("x"));
|
||||
arr.add("y", obj.getObjectArray().get("y"));
|
||||
} else {
|
||||
arr.add("x", new AMFObject( AMFObject.AMF_NUMBER, getPlayerById(id).getX() ) );
|
||||
arr.add("y", new AMFObject( AMFObject.AMF_NUMBER, getPlayerById(id).getY() ) );
|
||||
}
|
||||
getPlayerById(id).setCoords(arr.get("x").getDouble(), arr.get("y").getDouble());
|
||||
if( getPlayerById(id).isInLocation() ) {
|
||||
sendInLoc(getPlayerById(id).getLocation(), "_P", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_STRING, id ), new AMFObject( AMFObject.AMF_OBJECT_START, arr ), new AMFObject( AMFObject.AMF_NUMBER, num ));
|
||||
}
|
||||
}
|
||||
|
||||
public void setState( int id, String state ) {
|
||||
Player p = getPlayerById(id);
|
||||
getPlayerById(id).setState(Double.parseDouble( state ));
|
||||
if( p.isInLocation() ) {
|
||||
sendInLoc(p.getLocation(), "_S", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_STRING, id ), new AMFObject( AMFObject.AMF_NUMBER, state ));
|
||||
}
|
||||
}
|
||||
|
||||
public void throwSnowball( int id, double x, double y ) {
|
||||
if( getPlayerById(id).isInLocation() ) {
|
||||
sendInLoc(getPlayerById(id).getLocation(), "_NUS", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_STRING, id ), new AMFObject( AMFObject.AMF_NUMBER, x ), new AMFObject( AMFObject.AMF_NUMBER, y ) );
|
||||
}
|
||||
}
|
||||
|
||||
public void useMagicAbility( int id, double ability ) {
|
||||
if( getPlayerById(id).isInLocation() ) {
|
||||
sendInLoc(getPlayerById(id).getLocation(), "_NUM", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_STRING, id ), new AMFObject( AMFObject.AMF_NUMBER, ability ) );
|
||||
}
|
||||
}
|
||||
|
||||
public void chatMessage( int id, String msg ) {
|
||||
if( getPlayerById(id).isInLocation() ) {
|
||||
sendInLoc(getPlayerById(id).getLocation(), "_C", new AMFObject( AMFObject.AMF_NULL, null ), new AMFObject( AMFObject.AMF_STRING, id ), new AMFObject( AMFObject.AMF_STRING, msg ));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class Avatar {
|
||||
|
||||
private String getAG( int id ) {
|
||||
ArrayList<InventoryItem> bodyparts = new ArrayList<InventoryItem>();
|
||||
bodyparts.add(new InventoryItem(56, null, 0, null, 56, null, null, 56, 1, 16762375, null));
|
||||
bodyparts.add(new InventoryItem(60, null, 0, null, 60, null, null, 60, 1, 16762375, null));
|
||||
bodyparts.add(new InventoryItem(64, null, 0, null, 64, null, null, 64, 1, 16762375, null));
|
||||
bodyparts.add(new InventoryItem(69, null, 0, null, 69, null, null, 69, 1, 16762375, null));
|
||||
bodyparts.add(new InventoryItem(73, null, 0, null, 73, null, null, 73, 1, 16762375, null));
|
||||
bodyparts.add(new InventoryItem(77, null, 0, null, 77, null, null, 77, 1, 16762375, null));
|
||||
bodyparts.add(new InventoryItem(83, null, 0, null, 83, null, null, 83, 1, 16762375, null));
|
||||
bodyparts.add(new InventoryItem(89, null, 1, null, 89, null, null, 89, 1, 16762375, null));
|
||||
ArrayList<InventoryItem> legparts = new ArrayList<InventoryItem>();
|
||||
legparts.add(new InventoryItem(55, 0, 0, "", 55, 0, 0, 55, 1, 16762375, 1));
|
||||
legparts.add(new InventoryItem(62, 0, 0, "", 62, 0, 0, 62, 1, 16762375, 1));
|
||||
legparts.add(new InventoryItem(66, 0, 0, "", 66, 0, 0, 66, 1, 16762375, 1));
|
||||
legparts.add(new InventoryItem(71, 0, 0, "", 71, 0, 0, 71, 1, 16762375, 1));
|
||||
legparts.add(new InventoryItem(75, 0, 0, "", 75, 0, 0, 75, 1, 16762375, 1));
|
||||
legparts.add(new InventoryItem(80, 0, 1, "", 80, 0, 0, 80, 1, 16762375, 1));
|
||||
legparts.add(new InventoryItem(86, 0, 0, "", 86, 0, 0, 86, 1, 16762375, 1));
|
||||
legparts.add(new InventoryItem(92, 0, 0, "", 92, 0, 0, 92, 1, 16762375, 1));
|
||||
ArrayList<InventoryItem> earparts = new ArrayList<InventoryItem>();
|
||||
earparts.add(new InventoryItem(78, 0, 1, "", 78, 0, 0, 78, 1, 0, 1));
|
||||
earparts.add(new InventoryItem(84, 0, 0, "", 84, 0, 0, 84, 1, 16762375, 1));
|
||||
earparts.add(new InventoryItem(90, 0, 0, "", 90, 0, 0, 90, 1, 16762375, 1));
|
||||
earparts.add(new InventoryItem(95, 0, 0, "", 95, 0, 0, 95, 1, 16762375, 1));
|
||||
earparts.add(new InventoryItem(96, 0, 0, "", 96, 0, 0, 96, 1, 16762375, 1));
|
||||
earparts.add(new InventoryItem(97, 0, 0, "", 97, 0, 0, 97, 1, 16762375, 1));
|
||||
earparts.add(new InventoryItem(98, 0, 0, "", 98, 0, 0, 98, 1, 16762375, 1));
|
||||
ArrayList<InventoryItem> eyeparts = new ArrayList<InventoryItem>();
|
||||
eyeparts.add(new InventoryItem(59, 0, 1, "", 59, 0, 0, 59, 0, 1, 1));
|
||||
eyeparts.add(new InventoryItem(61, 0, 0, "", 61, 0, 0, 61, 0, 1, 1));
|
||||
eyeparts.add(new InventoryItem(65, 0, 0, "", 65, 0, 0, 65, 0, 1, 1));
|
||||
eyeparts.add(new InventoryItem(70, 0, 0, "", 70, 0, 0, 70, 0, 1, 1));
|
||||
eyeparts.add(new InventoryItem(74, 0, 0, "", 74, 0, 0, 74, 0, 1, 1));
|
||||
eyeparts.add(new InventoryItem(79, 0, 0, "", 79, 0, 0, 79, 0, 1, 1));
|
||||
eyeparts.add(new InventoryItem(85, 0, 0, "", 85, 0, 0, 85, 0, 1, 1));
|
||||
eyeparts.add(new InventoryItem(91, 0, 0, "", 91, 0, 0, 91, 0, 1, 1));
|
||||
ArrayList<InventoryItem> noseparts = new ArrayList<InventoryItem>();
|
||||
noseparts.add(new InventoryItem(58, 0, 1, "", 58, 0, 0, 58, 0, 1, 1));
|
||||
noseparts.add(new InventoryItem(68, 0, 0, "", 68, 0, 0, 68, 0, 1, 1));
|
||||
noseparts.add(new InventoryItem(82, 0, 0, "", 82, 0, 0, 82, 0, 1, 1));
|
||||
noseparts.add(new InventoryItem(88, 0, 0, "", 88, 0, 0, 88, 0, 1, 1));
|
||||
noseparts.add(new InventoryItem(94, 0, 0, "", 94, 0, 0, 94, 0, 1, 1));
|
||||
noseparts.add(new InventoryItem(98, 0, 0, "", 98, 0, 0, 98, 0, 1, 1));
|
||||
ArrayList<InventoryItem> mouthparts = new ArrayList<InventoryItem>();
|
||||
mouthparts.add(new InventoryItem(57, 0, 1, "", 57, 0, 0, 57, 0, 1, 1));
|
||||
mouthparts.add(new InventoryItem(67, 0, 0, "", 67, 0, 0, 67, 0, 1, 1));
|
||||
mouthparts.add(new InventoryItem(81, 0, 0, "", 81, 0, 0, 81, 0, 1, 1));
|
||||
mouthparts.add(new InventoryItem(87, 0, 0, "", 87, 0, 0, 87, 0, 1, 1));
|
||||
mouthparts.add(new InventoryItem(93, 0, 0, "", 93, 0, 0, 93, 0, 1, 1));
|
||||
ArrayList<InventoryItem> beakparts = new ArrayList<InventoryItem>();
|
||||
beakparts.add(new InventoryItem(63, 0, 1, "", 63, 0, 0, 63, 0, 1, 1));
|
||||
beakparts.add(new InventoryItem(72, 0, 0, "", 72, 0, 0, 72, 0, 1, 1));
|
||||
beakparts.add(new InventoryItem(76, 0, 0, "", 76, 0, 0, 76, 0, 1, 1));
|
||||
beakparts.add(new InventoryItem(98, 0, 0, "", 98, 0, 0, 98, 0, 1, 1));
|
||||
ArrayList<InventoryItem> hornparts = new ArrayList<InventoryItem>();
|
||||
hornparts.add(new InventoryItem(99, 0, 1, "", 99, 0, 0, 99, 0, 1, 1));
|
||||
hornparts.add(new InventoryItem(100, 0, 0, "", 100, 0, 0, 100, 0, 1, 1));
|
||||
hornparts.add(new InventoryItem(101, 0, 0, "", 101, 0, 0, 101, 0, 1, 1));
|
||||
hornparts.add(new InventoryItem(102, 0, 0, "", 102, 0, 0, 102, 0, 1, 1));
|
||||
hornparts.add(new InventoryItem(103, 0, 0, "", 103, 0, 0, 103, 0, 1, 1));
|
||||
hornparts.add(new InventoryItem(98, 0, 0, "", 98, 0, 0, 98, 0, 1, 1));
|
||||
InventoryGroup body = new InventoryGroup(3, 48, 0, 202, 20, bodyparts);
|
||||
InventoryGroup legs = new InventoryGroup(2, 47, 0, 201, 10, legparts);
|
||||
InventoryGroup ears = new InventoryGroup(8, 70, 0, 206, 50, earparts);
|
||||
InventoryGroup eyes = new InventoryGroup(7, 58, 0, 205, 30, eyeparts);
|
||||
InventoryGroup nose = new InventoryGroup(6, 57, 0, 204, 40, noseparts);
|
||||
InventoryGroup mouth = new InventoryGroup(5, 56, 0, 203, 26, mouthparts);
|
||||
InventoryGroup beak = new InventoryGroup(11, 110, 0, 208, 41, beakparts);
|
||||
InventoryGroup horn = new InventoryGroup(12, 166, 0, 209, 55, hornparts);
|
||||
InventoryGroup clothes = new InventoryGroup(1, 120, 0, 212, 36, DB.getGoodsFromInventory(id, "1"));
|
||||
InventoryGroup hats = new InventoryGroup(4, 21, 0, 211, 45, DB.getGoodsFromInventory(id, "4"));
|
||||
InventoryGroup glasses = new InventoryGroup(14, 62, 0, 210, 31, DB.getGoodsFromInventory(id, "14"));
|
||||
InventoryGroup shoes = new InventoryGroup(32, 123, 0, 213, 11, DB.getGoodsFromInventory(id, "32"));
|
||||
InventoryGroup misc = new InventoryGroup(36, 24, 0, 214, 56, DB.getGoodsFromInventory(id, "36"));
|
||||
InventoryGroup costumes = new InventoryGroup(40, 697, 0, 429, 27, DB.getGoodsFromInventory(id, "40"));
|
||||
ArrayList<InventoryGroup> invtab = new ArrayList<InventoryGroup>();
|
||||
invtab.add(clothes);
|
||||
invtab.add(hats);
|
||||
invtab.add(glasses);
|
||||
invtab.add(shoes);
|
||||
invtab.add(misc);
|
||||
invtab.add(costumes);
|
||||
ArrayList<InventoryGroup> shape = new ArrayList<InventoryGroup>();
|
||||
shape.add(body);
|
||||
shape.add(legs);
|
||||
ArrayList<InventoryGroup> bparts = new ArrayList<InventoryGroup>();
|
||||
bparts.add(ears);
|
||||
bparts.add(eyes);
|
||||
bparts.add(nose);
|
||||
bparts.add(mouth);
|
||||
bparts.add(beak);
|
||||
bparts.add(horn);
|
||||
for (InventoryGroup inventoryGroup : shape) {
|
||||
for (int j = 0; j < inventoryGroup.getItems().size(); j++) {
|
||||
inventoryGroup.getItems().get(j).setIsUsed(DB.getIsUsedGood(id, inventoryGroup.getItems().get(j)));
|
||||
inventoryGroup.getItems().get(j).setColor(DB.getBodyPartColor(id, inventoryGroup.getItems().get(j)));
|
||||
}
|
||||
}
|
||||
for (InventoryGroup bpart : bparts) {
|
||||
for (int j = 0; j < bpart.getItems().size(); j++) {
|
||||
bpart.getItems().get(j).setIsUsed(DB.getIsUsedGood(id, bpart.getItems().get(j)));
|
||||
bpart.getItems().get(j).setColor(DB.getBodyPartColor(id, bpart.getItems().get(j)));
|
||||
}
|
||||
}
|
||||
for (InventoryGroup bpart : invtab) {
|
||||
for (int j = 0; j < bpart.getItems().size(); j++) {
|
||||
bpart.getItems().get(j).setIsUsed(DB.getIsUsedGood(id, bpart.getItems().get(j)));
|
||||
}
|
||||
}
|
||||
Inventory inv = new Inventory(
|
||||
new InventoryTab( 199, shape ),
|
||||
new InventoryTab( 205, bparts ),
|
||||
new InventoryTab( 206, invtab ),
|
||||
new InventoryList( 230, new ArrayList<InventoryItem>()),
|
||||
new InventoryList( 231, new ArrayList<InventoryItem>()),
|
||||
new InventoryList( 211, new ArrayList<InventoryItem>()));
|
||||
return toXML(inv).replace("<user_avatar>", "").replace("</user_avatar>", "");
|
||||
}
|
||||
|
||||
private void setAG( int id, AMFEcmaArray arr ) {
|
||||
DB.clearUserdata(id);
|
||||
AMFObjectArray array = arr.getValueAt(0).getObjectArray();
|
||||
for( int i = 0; i < array.get("BodyParts").getECMArray().getLength(); i++ ) {
|
||||
AMFObjectArray obj = array.get("BodyParts").getECMArray().getValueAt(i).getObjectArray();
|
||||
String color = obj.get("Color").getString().equals("NaN") ? "-1" : obj.get("Color").getString();
|
||||
if( !obj.get("Id").getString().equals("98.0") ) {
|
||||
DB.insertUserdata(id,
|
||||
obj.get("Id").getString(), "1", obj.get("Id").getString(), color, "0");
|
||||
}
|
||||
}
|
||||
for( int i = 0; i < array.get("Inventory").getECMArray().getLength(); i++ ) {
|
||||
AMFObjectArray obj = array.get("Inventory").getECMArray().getValueAt(i).getObjectArray();
|
||||
DB.insertUserdata(id,
|
||||
obj.get("Id").getString(), "0", "0", "-1", obj.get("Id").getString());
|
||||
}
|
||||
}
|
||||
|
||||
private String getUserInitData( Player p ) {
|
||||
p.setName( DB.getPlayerName(p.getId()) );
|
||||
UserMagicAbilities ma = DB.getUserMagicAbilities(p.getId());
|
||||
UserAccount ua = DB.getUserAccount(p.getId());
|
||||
UserInfo ui = DB.getUserInfo(p.getId(), 0);
|
||||
UserPhone up = DB.getUserPhone(p.getId());
|
||||
ArrayList<InventoryItem> av = DB.getUserAvatar(p.getId());
|
||||
UserInitInfo init = new UserInitInfo( ma, ua, ui, up, av );
|
||||
return toXML(init);
|
||||
}
|
||||
|
||||
private AMFObjectArray getUE( int id ) {
|
||||
AMFObjectArray array = new AMFObjectArray();
|
||||
array.add("RoleFlags", new AMFObject( AMFObject.AMF_STRING, "2" ));
|
||||
AMFObjectArray user = new AMFObjectArray();
|
||||
user.add("Level", new AMFObject( AMFObject.AMF_STRING, "99" ));
|
||||
user.add("Name", new AMFObject( AMFObject.AMF_STRING, getPlayerById(id).getName() ));
|
||||
user.add("x", new AMFObject( AMFObject.AMF_STRING, getPlayerById(id).getX() ));
|
||||
user.add("y", new AMFObject( AMFObject.AMF_STRING, getPlayerById(id).getY() ));
|
||||
user.add("State", new AMFObject( AMFObject.AMF_NUMBER, String.valueOf( getPlayerById(id).getState() )));
|
||||
AMFObjectArray body = DB.getUserData(id);
|
||||
user.add("Body", new AMFObject( AMFObject.AMF_OBJECT_START, body ));
|
||||
array.add("User", new AMFObject( AMFObject.AMF_OBJECT_START, user ));
|
||||
return array;
|
||||
}
|
||||
|
||||
private String getUI( int id, String isFriend ) {
|
||||
//String avatar = DB.getUserDataXML( id );
|
||||
String avatar = "";
|
||||
return "<user UserId=\""+id+"\" Name=\""+DB.getPlayerName(id)+"\" RoleFlags=\""+DB.getPlayerRoleFlags(id)+"\" DateRegistered=\"2008-08-08T12:07:44.927\" IsLimited=\"0\" IsOnline=\"1\" IsMinorSecretAgent=\""+DB.getPlayerIsMinorSecretAgent(id)+"\" IsHomeLocked=\"1\" IsClubLocked=\""+DB.getPlayerIsClubLocked(id)+"\" IsClubPresent=\""+DB.getPlayerIsClubPresent(id)+"\" ClubAccessType=\"0\" IsFriend=\""+isFriend+"\" Experience=\""+DB.getPlayerExperience(id)+"\" Level=\""+DB.getPlayerLevel(id)+"\" PositiveEnergy=\"6\" MagicLevel=\""+DB.getPlayerMagicLevel(id)+"\" RaceLevel=\"0\" PhoneID=\""+DB.getPlayerPhoneID(id)+"\" BackgroundID=\""+DB.getPlayerBackgroundID(id)+"\" CampId=\"0\" NiftTotalCount=\"0\" LocationServerName=\"Неофициальный сервер\"><ExtendedInfo UserId=\""+id+"\" HasKey=\"0\" /><SpecialOffers><Offer Id=\"5002\" MinsLeft=\"494483\" ActionTypeId=\"0\" IconMRId=\"27214\" PopupMRId=\"27215\" /><Offer Id=\"10006\" MinsLeft=\"-396877\" ActionTypeId=\"3\" IconMRId=\"14831\" PopupMRId=\"14832\" /></SpecialOffers></user><avatar>"+avatar+"</avatar>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class Home {
|
||||
public ArrayList<AMFObject> getHome( ArrayList<AMFObject> result, int owner, int id ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, "<location ID=\"-1\" OwnerId=\""+owner+"\" OwnerName=\""+DB.getPlayerName(owner)+"\" IsHome=\"1\" IsClub=\"0\" IsLocked=\"\" IsVisaAccessPermitted=\"1\" MediaResourceID=\"708\" x=\"650.0\" y=\"520.0\"></location>"));
|
||||
System.out.println( result.get(result.size()-1).getString() );
|
||||
Base.updateLocationPlayers(id, -1);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private class Location {
|
||||
public ArrayList<AMFObject> getLocation( Player p, double id, double _id ) {
|
||||
ArrayList<AMFObject> result = new ArrayList<AMFObject>();
|
||||
result.add(new AMFObject( AMFObject.AMF_NULL, null ));
|
||||
if( id == 0.0 && _id == 0.0 ) {
|
||||
if( p.getCanModifyLocations() ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, org.cl0zzzy.sqlite.DB.getDefaultLocationXML().replace("IsHome=\"0\"", "IsHome=\"1\"") ));
|
||||
} else {
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, org.cl0zzzy.sqlite.DB.getDefaultLocationXML() ));
|
||||
}
|
||||
} else {
|
||||
if( p.getCanModifyLocations() ) {
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, org.cl0zzzy.sqlite.DB.getLocationXML((int)(id)).replace("IsHome=\"0\"", "IsHome=\"1\"") ));
|
||||
} else {
|
||||
result.add(new AMFObject( AMFObject.AMF_STRING, org.cl0zzzy.sqlite.DB.getLocationXML((int)(id)) ));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public int getLocationId( double id, double _id ) {
|
||||
if( id == 0.0 && _id == 0.0 ) {
|
||||
return org.cl0zzzy.sqlite.DB.getDefaultLocationId();
|
||||
} else {
|
||||
return org.cl0zzzy.sqlite.DB.getLocationId((int)(id));
|
||||
}
|
||||
}
|
||||
public String getLocationX( double id, double _id ) {
|
||||
if( id == 0.0 && _id == 0.0 ) {
|
||||
return org.cl0zzzy.sqlite.DB.getDefaultLocationX();
|
||||
} else {
|
||||
return org.cl0zzzy.sqlite.DB.getLocationX((int) (id));
|
||||
}
|
||||
}
|
||||
public String getLocationY( double id, double _id ) {
|
||||
if( id == 0.0 && _id == 0.0 ) {
|
||||
return org.cl0zzzy.sqlite.DB.getDefaultLocationY();
|
||||
} else {
|
||||
return org.cl0zzzy.sqlite.DB.getLocationY((int)(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
7
src/org/cl0zzzy/server/UData.java
Normal file
7
src/org/cl0zzzy/server/UData.java
Normal file
@ -0,0 +1,7 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
public class UData {
|
||||
public String id;
|
||||
public String color = null;
|
||||
public boolean isBodyPart;
|
||||
}
|
32
src/org/cl0zzzy/server/UserAccount.java
Normal file
32
src/org/cl0zzzy/server/UserAccount.java
Normal file
@ -0,0 +1,32 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
@Root(name="account")
|
||||
public class UserAccount {
|
||||
private int PhoneCardBalance;
|
||||
private int WeaponsCount;
|
||||
private int OxigenUnits;
|
||||
|
||||
public UserAccount(int phoneCardBalance, int weaponsCount, int oxigenUnits) {
|
||||
PhoneCardBalance = phoneCardBalance;
|
||||
WeaponsCount = weaponsCount;
|
||||
OxigenUnits = oxigenUnits;
|
||||
}
|
||||
|
||||
@Attribute(name="PhoneCardBalance")
|
||||
public int getPhoneCardBalance() {
|
||||
return PhoneCardBalance;
|
||||
}
|
||||
|
||||
@Attribute(name="WeaponsCount")
|
||||
public int getWeaponsCount() {
|
||||
return WeaponsCount;
|
||||
}
|
||||
|
||||
@Attribute(name="OxigenUnits")
|
||||
public int getOxigenUnits() {
|
||||
return OxigenUnits;
|
||||
}
|
||||
}
|
258
src/org/cl0zzzy/server/UserInfo.java
Normal file
258
src/org/cl0zzzy/server/UserInfo.java
Normal file
@ -0,0 +1,258 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
@Root(name="user")
|
||||
public class UserInfo implements ParsableObject {
|
||||
private int UserId;
|
||||
private int RoleFlags;
|
||||
private int IsLimited;
|
||||
private int IsOnline;
|
||||
private int IsMinorSecretAgent;
|
||||
private int IsHomeLocked;
|
||||
private int IsClubLocked;
|
||||
private int IsClubPresent;
|
||||
private int ClubAccessType;
|
||||
private int IsFriend;
|
||||
private int Experience;
|
||||
private int Level;
|
||||
private int PositiveEnergy;
|
||||
private int MagicLevel;
|
||||
private int RaceLevel;
|
||||
private int PhoneID;
|
||||
private int BackgroundID;
|
||||
private int CampId;
|
||||
private int NiftTotalCount;
|
||||
private String LocationServerName;
|
||||
private String DateRegistered;
|
||||
private int InstructorLevel;
|
||||
private int UsualTickets;
|
||||
private int MagicTickets;
|
||||
private int VisaId;
|
||||
private int CurrentUseCount;
|
||||
private int LastNewspaperId;
|
||||
private int HasSnFriends;
|
||||
private int MinsLeft;
|
||||
private int TimesUsed;
|
||||
private String Name;
|
||||
|
||||
public UserInfo(int userId,
|
||||
int roleFlags,
|
||||
int isLimited,
|
||||
int isOnline,
|
||||
int isMinorSecretAgent,
|
||||
int isHomeLocked,
|
||||
int isClubLocked,
|
||||
int isClubPresent,
|
||||
int clubAccessType,
|
||||
int isFriend,
|
||||
int experience,
|
||||
int level,
|
||||
int positiveEnergy,
|
||||
int magicLevel,
|
||||
int raceLevel,
|
||||
int phoneID,
|
||||
int backgroundID,
|
||||
int campId,
|
||||
int niftTotalCount,
|
||||
String locationServerName,
|
||||
String dateRegistered,
|
||||
int instructorLevel,
|
||||
int usualTickets,
|
||||
int magicTickets,
|
||||
int visaId,
|
||||
int currentUseCount,
|
||||
int lastNewspaperId,
|
||||
int hasSnFriends,
|
||||
int minsLeft,
|
||||
int timesUsed,
|
||||
String name ) {
|
||||
UserId = userId;
|
||||
RoleFlags = roleFlags;
|
||||
IsLimited = isLimited;
|
||||
IsOnline = isOnline;
|
||||
IsMinorSecretAgent = isMinorSecretAgent;
|
||||
IsHomeLocked = isHomeLocked;
|
||||
IsClubLocked = isClubLocked;
|
||||
IsClubPresent = isClubPresent;
|
||||
ClubAccessType = clubAccessType;
|
||||
IsFriend = isFriend;
|
||||
Experience = experience;
|
||||
Level = level;
|
||||
PositiveEnergy = positiveEnergy;
|
||||
MagicLevel = magicLevel;
|
||||
RaceLevel = raceLevel;
|
||||
PhoneID = phoneID;
|
||||
BackgroundID = backgroundID;
|
||||
CampId = campId;
|
||||
NiftTotalCount = niftTotalCount;
|
||||
LocationServerName = locationServerName;
|
||||
DateRegistered = dateRegistered;
|
||||
InstructorLevel = instructorLevel;
|
||||
UsualTickets = usualTickets;
|
||||
MagicTickets = magicTickets;
|
||||
VisaId = visaId;
|
||||
CurrentUseCount = currentUseCount;
|
||||
LastNewspaperId = lastNewspaperId;
|
||||
HasSnFriends = hasSnFriends;
|
||||
MinsLeft = minsLeft;
|
||||
TimesUsed = timesUsed;
|
||||
Name = name;
|
||||
}
|
||||
|
||||
@Attribute(name="Name")
|
||||
public String getName() {
|
||||
return Name;
|
||||
}
|
||||
|
||||
@Attribute(name="UserId")
|
||||
public int getUserId() {
|
||||
return UserId;
|
||||
}
|
||||
|
||||
@Attribute(name="RoleFlags")
|
||||
public int getRoleFlags() {
|
||||
return RoleFlags;
|
||||
}
|
||||
|
||||
@Attribute(name="IsLimited")
|
||||
public int getIsLimited() {
|
||||
return IsLimited;
|
||||
}
|
||||
|
||||
@Attribute(name="IsOnline")
|
||||
public int getIsOnline() {
|
||||
return IsOnline;
|
||||
}
|
||||
|
||||
@Attribute(name="IsMinorSecretAgent")
|
||||
public int getIsMinorSecretAgent() {
|
||||
return IsMinorSecretAgent;
|
||||
}
|
||||
|
||||
@Attribute(name="IsHomeLocked")
|
||||
public int getIsHomeLocked() {
|
||||
return IsHomeLocked;
|
||||
}
|
||||
|
||||
@Attribute(name="IsClubLocked")
|
||||
public int getIsClubLocked() {
|
||||
return IsClubLocked;
|
||||
}
|
||||
|
||||
@Attribute(name="IsClubPresent")
|
||||
public int getIsClubPresent() {
|
||||
return IsClubPresent;
|
||||
}
|
||||
|
||||
@Attribute(name="ClubAccessType")
|
||||
public int getClubAccessType() {
|
||||
return ClubAccessType;
|
||||
}
|
||||
|
||||
@Attribute(name="IsFriend")
|
||||
public int getIsFriend() {
|
||||
return IsFriend;
|
||||
}
|
||||
|
||||
@Attribute(name="Experience")
|
||||
public int getExperience() {
|
||||
return Experience;
|
||||
}
|
||||
|
||||
@Attribute(name="Level")
|
||||
public int getLevel() {
|
||||
return Level;
|
||||
}
|
||||
|
||||
@Attribute(name="PositiveEnergy")
|
||||
public int getPositiveEnergy() {
|
||||
return PositiveEnergy;
|
||||
}
|
||||
|
||||
@Attribute(name="MagicLevel")
|
||||
public int getMagicLevel() {
|
||||
return MagicLevel;
|
||||
}
|
||||
|
||||
@Attribute(name="RaceLevel")
|
||||
public int getRaceLevel() {
|
||||
return RaceLevel;
|
||||
}
|
||||
|
||||
@Attribute(name="PhoneID")
|
||||
public int getPhoneID() {
|
||||
return PhoneID;
|
||||
}
|
||||
|
||||
@Attribute(name="BackgroundID")
|
||||
public int getBackgroundID() {
|
||||
return BackgroundID;
|
||||
}
|
||||
|
||||
@Attribute(name="CampId")
|
||||
public int getCampId() {
|
||||
return CampId;
|
||||
}
|
||||
|
||||
@Attribute(name="NiftTotalCount")
|
||||
public int getNiftTotalCount() {
|
||||
return NiftTotalCount;
|
||||
}
|
||||
|
||||
@Attribute(name="LocationServerName")
|
||||
public String getLocationServerName() {
|
||||
return LocationServerName;
|
||||
}
|
||||
|
||||
@Attribute(name="DateRegistered")
|
||||
public String getDateRegistered() {
|
||||
return DateRegistered;
|
||||
}
|
||||
|
||||
@Attribute(name="InstructorLevel")
|
||||
public int getInstructorLevel() {
|
||||
return InstructorLevel;
|
||||
}
|
||||
|
||||
@Attribute(name="UsualTickets")
|
||||
public int getUsualTickets() {
|
||||
return UsualTickets;
|
||||
}
|
||||
|
||||
@Attribute(name="MagicTickets")
|
||||
public int getMagicTickets() {
|
||||
return MagicTickets;
|
||||
}
|
||||
|
||||
@Attribute(name="VisaId")
|
||||
public int getVisaId() {
|
||||
return VisaId;
|
||||
}
|
||||
|
||||
@Attribute(name="CurrentUseCount")
|
||||
public int getCurrentUseCount() {
|
||||
return CurrentUseCount;
|
||||
}
|
||||
|
||||
@Attribute(name="LastNewspaperId")
|
||||
public int getLastNewspaperId() {
|
||||
return LastNewspaperId;
|
||||
}
|
||||
|
||||
@Attribute(name="HasSnFriends")
|
||||
public int getHasSnFriends() {
|
||||
return HasSnFriends;
|
||||
}
|
||||
|
||||
@Attribute(name="MinsLeft")
|
||||
public int getMinsLeft() {
|
||||
return MinsLeft;
|
||||
}
|
||||
|
||||
@Attribute(name="TimesUsed")
|
||||
public int getTimesUsed() {
|
||||
return TimesUsed;
|
||||
}
|
||||
}
|
48
src/org/cl0zzzy/server/UserInitInfo.java
Normal file
48
src/org/cl0zzzy/server/UserInitInfo.java
Normal file
@ -0,0 +1,48 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Element;
|
||||
import org.simpleframework.xml.ElementList;
|
||||
import org.simpleframework.xml.Root;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Root(name="response")
|
||||
public class UserInitInfo implements ParsableObject {
|
||||
private UserMagicAbilities magicAbilities;
|
||||
private UserAccount userAccount;
|
||||
private UserInfo userInfo;
|
||||
private UserPhone userPhone;
|
||||
private ArrayList<InventoryItem> avatar;
|
||||
|
||||
@Element(name="user_magic_abilities")
|
||||
public UserMagicAbilities getMagicAbilities() {
|
||||
return magicAbilities;
|
||||
}
|
||||
|
||||
@Element(name="account")
|
||||
public UserAccount getUserAccount() {
|
||||
return userAccount;
|
||||
}
|
||||
|
||||
@Element(name="user")
|
||||
public UserInfo getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
@Element(name="user_phone")
|
||||
public UserPhone getUserPhone() {
|
||||
return userPhone;
|
||||
}
|
||||
|
||||
@ElementList(inline = true, name="avatar")
|
||||
public ArrayList<InventoryItem> getAvatar() {
|
||||
return this.avatar;
|
||||
}
|
||||
|
||||
public UserInitInfo(UserMagicAbilities magicAbilities, UserAccount userAccount, UserInfo userInfo, UserPhone userPhone, ArrayList<InventoryItem> avatar) {
|
||||
this.magicAbilities = magicAbilities;
|
||||
this.userAccount = userAccount;
|
||||
this.userInfo = userInfo;
|
||||
this.userPhone = userPhone;
|
||||
this.avatar = avatar;
|
||||
}
|
||||
}
|
20
src/org/cl0zzzy/server/UserMagicAbilities.java
Normal file
20
src/org/cl0zzzy/server/UserMagicAbilities.java
Normal file
@ -0,0 +1,20 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.ElementList;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Root(name="user_magic_abilities")
|
||||
public class UserMagicAbilities {
|
||||
private ArrayList<MagicAbility> ma;
|
||||
|
||||
public UserMagicAbilities( ArrayList<MagicAbility> ma ) {
|
||||
this.ma = ma;
|
||||
}
|
||||
|
||||
@ElementList(inline = true, name="ability")
|
||||
public ArrayList<MagicAbility> getMagicAbilities() {
|
||||
return this.ma;
|
||||
}
|
||||
}
|
39
src/org/cl0zzzy/server/UserPhone.java
Normal file
39
src/org/cl0zzzy/server/UserPhone.java
Normal file
@ -0,0 +1,39 @@
|
||||
package org.cl0zzzy.server;
|
||||
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
@Root(name="user_phone")
|
||||
public class UserPhone {
|
||||
private int BufferSize;
|
||||
private int SkinMediaResourceID;
|
||||
private int PhoneId;
|
||||
private int Balance;
|
||||
|
||||
@Attribute(name="BufferSize")
|
||||
public int getBufferSize() {
|
||||
return BufferSize;
|
||||
}
|
||||
|
||||
@Attribute(name="SkinMediaResourceID")
|
||||
public int getSkinMediaResourceID() {
|
||||
return SkinMediaResourceID;
|
||||
}
|
||||
|
||||
@Attribute(name="PhoneId")
|
||||
public int getPhoneId() {
|
||||
return PhoneId;
|
||||
}
|
||||
|
||||
@Attribute(name="Balance")
|
||||
public int getBalance() {
|
||||
return Balance;
|
||||
}
|
||||
|
||||
public UserPhone(int bufferSize, int skinMediaResourceID, int phoneId, int balance) {
|
||||
BufferSize = bufferSize;
|
||||
SkinMediaResourceID = skinMediaResourceID;
|
||||
PhoneId = phoneId;
|
||||
Balance = balance;
|
||||
}
|
||||
}
|
25
src/org/cl0zzzy/sqlite/Account.java
Normal file
25
src/org/cl0zzzy/sqlite/Account.java
Normal file
@ -0,0 +1,25 @@
|
||||
package org.cl0zzzy.sqlite;
|
||||
|
||||
public class Account {
|
||||
private String name;
|
||||
private String password;
|
||||
private int id;
|
||||
|
||||
public Account(int id, String name, String password) {
|
||||
this.name = name;
|
||||
this.password = password;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
1075
src/org/cl0zzzy/sqlite/DB.java
Normal file
1075
src/org/cl0zzzy/sqlite/DB.java
Normal file
File diff suppressed because it is too large
Load Diff
3334
src/res/css/animate.css
vendored
Normal file
3334
src/res/css/animate.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2337
src/res/css/font-awesome.css
vendored
Normal file
2337
src/res/css/font-awesome.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
src/res/css/font-awesome.min.css
vendored
Normal file
4
src/res/css/font-awesome.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
39
src/res/css/main.css
Normal file
39
src/res/css/main.css
Normal file
@ -0,0 +1,39 @@
|
||||
/* Possibly the shittiest CSS ever */
|
||||
@import url(https://fonts.googleapis.com/css?family=Duru+Sans);
|
||||
|
||||
body {
|
||||
font-family: 'Duru Sans', sans-serif;
|
||||
}
|
||||
|
||||
form {
|
||||
margin-left: 1%;
|
||||
}
|
||||
|
||||
#title {
|
||||
margin-left: 1%;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 3px;
|
||||
font-weight: 560;
|
||||
font-size: 2.3em;
|
||||
}
|
||||
|
||||
.form-group > input {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.form-group > select {
|
||||
width: 15%;
|
||||
}
|
||||
|
||||
.alert {
|
||||
margin-left: 1%;
|
||||
width: 35%;
|
||||
}
|
||||
|
||||
span {
|
||||
margin-right: 1%;
|
||||
}
|
||||
|
||||
.g-recaptcha {
|
||||
margin-top: 1%;
|
||||
}
|
342
src/res/css/style.css
Normal file
342
src/res/css/style.css
Normal file
@ -0,0 +1,342 @@
|
||||
* {
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
width: 100%;
|
||||
margin: 0px;
|
||||
background-image: url(/img/background.jpg);
|
||||
background-repeat: repeat-y no-repeat;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
background-attachment: fixed;
|
||||
}
|
||||
|
||||
.icons>a {
|
||||
text-decoration: none;
|
||||
color: darkgray;
|
||||
}
|
||||
|
||||
.location>a {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.location:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.left {
|
||||
margin-left: 5%;
|
||||
}
|
||||
.left>a {
|
||||
margin-bottom: 5%;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1001px) {
|
||||
.card {
|
||||
margin-left: 32%;
|
||||
margin-top: 2%;
|
||||
padding: 0px;
|
||||
background-color: white;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
||||
transition: 0.3s;
|
||||
width: 35%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.card:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 1);
|
||||
}
|
||||
img {
|
||||
border: 20px solid white;
|
||||
border-radius: 50%;
|
||||
margin-top: 8%;
|
||||
margin-bottom: -15% !important;
|
||||
width: 30%;
|
||||
}
|
||||
.name {
|
||||
text-align: center;
|
||||
font-size: 2.8em;
|
||||
color: gainsboro;
|
||||
margin-top: 15%;
|
||||
margin-bottom: auto;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
hr {
|
||||
width: 93%;
|
||||
height: 2px;
|
||||
background-color: gainsboro;
|
||||
border: 0px;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 1.5em;
|
||||
color: darkgray;
|
||||
}
|
||||
.icons {
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
color: darkgray;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.location {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 1.5em;
|
||||
display: block;
|
||||
background-color: cornflowerblue;
|
||||
padding: 10px;
|
||||
margin-left: 7%;
|
||||
margin-right: 7%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 100px) and (max-width: 728px) and (orientation:portrait) {
|
||||
body {
|
||||
width: 100%;
|
||||
margin: 0px;
|
||||
background: url(/img/background.jpg) fixed no;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
hr {
|
||||
width: 93%;
|
||||
height: 2px;
|
||||
background-color: gainsboro;
|
||||
border: 0px;
|
||||
}
|
||||
.card {
|
||||
margin-top: 10%;
|
||||
margin-left: 2%;
|
||||
margin-right: 0px;
|
||||
background-color: white;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
||||
transition: 0.3s;
|
||||
width: 95%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.card:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 1);
|
||||
}
|
||||
img {
|
||||
border: 15px solid white;
|
||||
margin-bottom: -20% !important;
|
||||
border-radius: 50%;
|
||||
width: 33%;
|
||||
}
|
||||
.name {
|
||||
padding-right: 4px;
|
||||
padding-left: 4px;
|
||||
text-align: center;
|
||||
font-size: 2.5em;
|
||||
color: gainsboro;
|
||||
margin-top: 16%;
|
||||
margin-bottom: auto;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 1.2em;
|
||||
color: darkgray;
|
||||
}
|
||||
.icons {
|
||||
font-size: 11px;
|
||||
text-align: center;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
color: darkgray;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.location {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 0.8em;
|
||||
display: block;
|
||||
background-color: cornflowerblue;
|
||||
padding: 10px;
|
||||
margin-left: 7%;
|
||||
margin-right: 7%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 100px) and (max-width: 728px) and (orientation:landscape) {
|
||||
body {
|
||||
width: 100%;
|
||||
margin: 0px;
|
||||
background: url(/img/background.png) fixed no;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
hr {
|
||||
width: 93%;
|
||||
height: 2px;
|
||||
background-color: gainsboro;
|
||||
border: 0px;
|
||||
}
|
||||
.card {
|
||||
margin-top: 6%;
|
||||
margin-left: 9%;
|
||||
margin-right: 0px;
|
||||
background-color: white;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
||||
transition: 0.3s;
|
||||
width: 80%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.card:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 1);
|
||||
}
|
||||
img {
|
||||
border: 15px solid white;
|
||||
margin-bottom: -15% !important;
|
||||
border-radius: 50%;
|
||||
width: 25%;
|
||||
}
|
||||
.name {
|
||||
padding-right: 4px;
|
||||
padding-left: 4px;
|
||||
text-align: center;
|
||||
font-size: 2.8em;
|
||||
color: gainsboro;
|
||||
margin-top: 16%;
|
||||
margin-bottom: auto;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 1.9em;
|
||||
color: darkgray;
|
||||
}
|
||||
.icons {
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
color: darkgray;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.location {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 1.5em;
|
||||
display: block;
|
||||
background-color: cornflowerblue;
|
||||
padding: 10px;
|
||||
margin-left: 7%;
|
||||
margin-right: 7%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 728px) and (max-width: 1000px) {
|
||||
body {
|
||||
width: 100%;
|
||||
margin: 0px;
|
||||
background: url(/img/background.png) fixed no;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
hr {
|
||||
width: 93%;
|
||||
height: 2px;
|
||||
background-color: gainsboro;
|
||||
border: 0px;
|
||||
}
|
||||
.card {
|
||||
margin-top: 4%;
|
||||
margin-left: 13%;
|
||||
align-content: center;
|
||||
background-color: white;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
||||
transition: 0.3s;
|
||||
width: 75%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.card:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 1);
|
||||
}
|
||||
img {
|
||||
border: 15px solid white;
|
||||
margin-bottom: -18% !important;
|
||||
border-radius: 50%;
|
||||
width: 30%;
|
||||
}
|
||||
.name {
|
||||
text-align: center;
|
||||
font-size: 2.5em;
|
||||
color: gainsboro;
|
||||
margin-top: 16%;
|
||||
margin-bottom: auto;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 2em;
|
||||
color: darkgray;
|
||||
}
|
||||
.icons {
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
color: darkgray;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.location {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 1.8em;
|
||||
display: block;
|
||||
background-color: cornflowerblue;
|
||||
padding: 10px;
|
||||
margin-left: 7%;
|
||||
margin-right: 7%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.fa-stack:hover {
|
||||
transition: 0.9s;
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
|
||||
.fa-lg {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.fa-twitter:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: #1da1f2;
|
||||
}
|
||||
|
||||
.fa-facebook:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: #3b5998;
|
||||
}
|
||||
|
||||
.fa-google-plus:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: #dd4b39;
|
||||
}
|
||||
|
||||
.fa-github:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
.fa-instagram:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: #5851db;
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 1.2em
|
||||
}
|
BIN
src/res/img/background.jpg
Normal file
BIN
src/res/img/background.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 259 KiB |
BIN
src/res/img/module_table_bottom.png
Normal file
BIN
src/res/img/module_table_bottom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 751 B |
BIN
src/res/img/module_table_top.png
Normal file
BIN
src/res/img/module_table_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 337 B |
BIN
src/res/img/snow_background.png
Normal file
BIN
src/res/img/snow_background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 259 KiB |
36
src/res/items.html
Normal file
36
src/res/items.html
Normal file
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<style>
|
||||
table {
|
||||
font-family: arial, sans-serif;
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td, th {
|
||||
border: 1px solid #dddddd;
|
||||
text-align: left;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background-color: #dddddd;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>HTML Table</h2>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
TEXT_BODY
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
400
src/res/log.html
Normal file
400
src/res/log.html
Normal file
@ -0,0 +1,400 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Войти | Unofficial</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/style.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/animate.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:700" rel="stylesheet">
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
* {
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
width: 100%;
|
||||
margin: 0px;
|
||||
background-image: url(/img/background.jpg);
|
||||
background-repeat: repeat-y no-repeat;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
background-attachment: fixed;
|
||||
}
|
||||
|
||||
.icons>a {
|
||||
text-decoration: none;
|
||||
color: darkgray;
|
||||
}
|
||||
|
||||
.location>a {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.location:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.left {
|
||||
margin-left: 5%;
|
||||
}
|
||||
.left>a {
|
||||
margin-bottom: 5%;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1001px) {
|
||||
.card {
|
||||
margin-left: 32%;
|
||||
margin-top: 2%;
|
||||
padding: 0px;
|
||||
background-color: white;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
||||
transition: 0.3s;
|
||||
width: 35%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.card:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 1);
|
||||
}
|
||||
img {
|
||||
border: 20px solid white;
|
||||
border-radius: 50%;
|
||||
margin-top: 8%;
|
||||
margin-bottom: -15% !important;
|
||||
width: 30%;
|
||||
}
|
||||
.name {
|
||||
text-align: center;
|
||||
font-size: 2.8em;
|
||||
color: gainsboro;
|
||||
margin-top: 15%;
|
||||
margin-bottom: auto;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
hr {
|
||||
width: 93%;
|
||||
height: 2px;
|
||||
background-color: gainsboro;
|
||||
border: 0px;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 1.5em;
|
||||
color: darkgray;
|
||||
}
|
||||
.icons {
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
color: darkgray;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.location {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 1.5em;
|
||||
display: block;
|
||||
background-color: cornflowerblue;
|
||||
padding: 10px;
|
||||
margin-left: 7%;
|
||||
margin-right: 7%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 100px) and (max-width: 728px) and (orientation:portrait) {
|
||||
body {
|
||||
width: 100%;
|
||||
margin: 0px;
|
||||
background: url(/img/background.jpg) fixed no;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
hr {
|
||||
width: 93%;
|
||||
height: 2px;
|
||||
background-color: gainsboro;
|
||||
border: 0px;
|
||||
}
|
||||
.card {
|
||||
margin-top: 10%;
|
||||
margin-left: 2%;
|
||||
margin-right: 0px;
|
||||
background-color: white;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
||||
transition: 0.3s;
|
||||
width: 95%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.card:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 1);
|
||||
}
|
||||
img {
|
||||
border: 15px solid white;
|
||||
margin-bottom: -20% !important;
|
||||
border-radius: 50%;
|
||||
width: 33%;
|
||||
}
|
||||
.name {
|
||||
padding-right: 4px;
|
||||
padding-left: 4px;
|
||||
text-align: center;
|
||||
font-size: 2.5em;
|
||||
color: gainsboro;
|
||||
margin-top: 16%;
|
||||
margin-bottom: auto;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 1.2em;
|
||||
color: darkgray;
|
||||
}
|
||||
.icons {
|
||||
font-size: 11px;
|
||||
text-align: center;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
color: darkgray;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.location {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 0.8em;
|
||||
display: block;
|
||||
background-color: cornflowerblue;
|
||||
padding: 10px;
|
||||
margin-left: 7%;
|
||||
margin-right: 7%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 100px) and (max-width: 728px) and (orientation:landscape) {
|
||||
body {
|
||||
width: 100%;
|
||||
margin: 0px;
|
||||
background: url(/img/background.png) fixed no;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
hr {
|
||||
width: 93%;
|
||||
height: 2px;
|
||||
background-color: gainsboro;
|
||||
border: 0px;
|
||||
}
|
||||
.card {
|
||||
margin-top: 6%;
|
||||
margin-left: 9%;
|
||||
margin-right: 0px;
|
||||
background-color: white;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
||||
transition: 0.3s;
|
||||
width: 80%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.card:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 1);
|
||||
}
|
||||
img {
|
||||
border: 15px solid white;
|
||||
margin-bottom: -15% !important;
|
||||
border-radius: 50%;
|
||||
width: 25%;
|
||||
}
|
||||
.name {
|
||||
padding-right: 4px;
|
||||
padding-left: 4px;
|
||||
text-align: center;
|
||||
font-size: 2.8em;
|
||||
color: gainsboro;
|
||||
margin-top: 16%;
|
||||
margin-bottom: auto;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 1.9em;
|
||||
color: darkgray;
|
||||
}
|
||||
.icons {
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
color: darkgray;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.location {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 1.5em;
|
||||
display: block;
|
||||
background-color: cornflowerblue;
|
||||
padding: 10px;
|
||||
margin-left: 7%;
|
||||
margin-right: 7%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 728px) and (max-width: 1000px) {
|
||||
body {
|
||||
width: 100%;
|
||||
margin: 0px;
|
||||
background: url(/img/background.png) fixed no;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
hr {
|
||||
width: 93%;
|
||||
height: 2px;
|
||||
background-color: gainsboro;
|
||||
border: 0px;
|
||||
}
|
||||
.card {
|
||||
margin-top: 4%;
|
||||
margin-left: 13%;
|
||||
align-content: center;
|
||||
background-color: white;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
||||
transition: 0.3s;
|
||||
width: 75%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.card:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 1);
|
||||
}
|
||||
img {
|
||||
border: 15px solid white;
|
||||
margin-bottom: -18% !important;
|
||||
border-radius: 50%;
|
||||
width: 30%;
|
||||
}
|
||||
.name {
|
||||
text-align: center;
|
||||
font-size: 2.5em;
|
||||
color: gainsboro;
|
||||
margin-top: 16%;
|
||||
margin-bottom: auto;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 2em;
|
||||
color: darkgray;
|
||||
}
|
||||
.icons {
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
color: darkgray;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.location {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 1.8em;
|
||||
display: block;
|
||||
background-color: cornflowerblue;
|
||||
padding: 10px;
|
||||
margin-left: 7%;
|
||||
margin-right: 7%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.fa-stack:hover {
|
||||
transition: 0.9s;
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
|
||||
.fa-lg {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.fa-twitter:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: #1da1f2;
|
||||
}
|
||||
|
||||
.fa-facebook:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: #3b5998;
|
||||
}
|
||||
|
||||
.fa-google-plus:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: #dd4b39;
|
||||
}
|
||||
|
||||
.fa-github:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
.fa-instagram:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: #5851db;
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 1.2em
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin-top: 8%;" >
|
||||
<div class="card animated fadeIn">
|
||||
<form method="POST">
|
||||
<hr>
|
||||
<div class="name">
|
||||
<h1>Войти</h1>
|
||||
</div>
|
||||
<center><div id="success" class="alert alert-success alert-dismissible" role="alert" style="display:none; width:430px">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<div class="alert-message"></div>
|
||||
</div>
|
||||
<div id="error" class="alert alert-danger alert-dismissible" role="alert" style="display:none; width:430px">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<div class="alert-message"></div>
|
||||
</div>
|
||||
<form id="register">
|
||||
<div class="form-group">
|
||||
<label for="username">Имя</label>
|
||||
<input type="text" name="username" class="form-control" id="username" placeholder="Имя" style="width:430px; height:34px">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Пароль</label>
|
||||
<input type="password" name="password" class="form-control" id="password" placeholder="Пароль" style="width:430px; height:34px">
|
||||
</div>
|
||||
<br>
|
||||
<input type="submit" name="submit" value="Войти" class="btn btn-default">
|
||||
|
||||
</input>
|
||||
<a class="btn btn-default" href="?act=register">Регистрация</a>
|
||||
|
||||
</form>
|
||||
<br><br>
|
||||
</center>
|
||||
</form>
|
||||
</div>
|
||||
<footer class="animated fadeIn">
|
||||
<p></p>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
</html>
|
8
src/res/main.html
Normal file
8
src/res/main.html
Normal file
@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Игра | Unofficial</title>
|
||||
</head>
|
||||
<body>
|
||||
<embed type="application/x-shockwave-flash" src="swf/base.swf" style="height: 100%; width: 100%" flashvars="game_server=http%3A%2F%2FREPLACE_FOR_DOMAIN%2F&url_path_server=http%3A%2F%2FREPLACE_FOR_DOMAIN%2F&portal_url=http%3A%2F%2FREPLACE_FOR_DOMAIN%2F&manual_server_selection=1&start_step=0">
|
||||
</body>
|
||||
</html>
|
398
src/res/reg.html
Normal file
398
src/res/reg.html
Normal file
@ -0,0 +1,398 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Войти | Unofficial</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/style.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/animate.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:700" rel="stylesheet">
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
* {
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
width: 100%;
|
||||
margin: 0px;
|
||||
background-image: url(/img/background.jpg);
|
||||
background-repeat: repeat-y no-repeat;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
background-attachment: fixed;
|
||||
}
|
||||
|
||||
.icons>a {
|
||||
text-decoration: none;
|
||||
color: darkgray;
|
||||
}
|
||||
|
||||
.location>a {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.location:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.left {
|
||||
margin-left: 5%;
|
||||
}
|
||||
.left>a {
|
||||
margin-bottom: 5%;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1001px) {
|
||||
.card {
|
||||
margin-left: 32%;
|
||||
margin-top: 2%;
|
||||
padding: 0px;
|
||||
background-color: white;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
||||
transition: 0.3s;
|
||||
width: 35%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.card:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 1);
|
||||
}
|
||||
img {
|
||||
border: 20px solid white;
|
||||
border-radius: 50%;
|
||||
margin-top: 8%;
|
||||
margin-bottom: -15% !important;
|
||||
width: 30%;
|
||||
}
|
||||
.name {
|
||||
text-align: center;
|
||||
font-size: 2.8em;
|
||||
color: gainsboro;
|
||||
margin-top: 15%;
|
||||
margin-bottom: auto;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
hr {
|
||||
width: 93%;
|
||||
height: 2px;
|
||||
background-color: gainsboro;
|
||||
border: 0px;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 1.5em;
|
||||
color: darkgray;
|
||||
}
|
||||
.icons {
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
color: darkgray;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.location {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 1.5em;
|
||||
display: block;
|
||||
background-color: cornflowerblue;
|
||||
padding: 10px;
|
||||
margin-left: 7%;
|
||||
margin-right: 7%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 100px) and (max-width: 728px) and (orientation:portrait) {
|
||||
body {
|
||||
width: 100%;
|
||||
margin: 0px;
|
||||
background: url(/img/background.jpg) fixed no;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
hr {
|
||||
width: 93%;
|
||||
height: 2px;
|
||||
background-color: gainsboro;
|
||||
border: 0px;
|
||||
}
|
||||
.card {
|
||||
margin-top: 10%;
|
||||
margin-left: 2%;
|
||||
margin-right: 0px;
|
||||
background-color: white;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
||||
transition: 0.3s;
|
||||
width: 95%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.card:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 1);
|
||||
}
|
||||
img {
|
||||
border: 15px solid white;
|
||||
margin-bottom: -20% !important;
|
||||
border-radius: 50%;
|
||||
width: 33%;
|
||||
}
|
||||
.name {
|
||||
padding-right: 4px;
|
||||
padding-left: 4px;
|
||||
text-align: center;
|
||||
font-size: 2.5em;
|
||||
color: gainsboro;
|
||||
margin-top: 16%;
|
||||
margin-bottom: auto;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 1.2em;
|
||||
color: darkgray;
|
||||
}
|
||||
.icons {
|
||||
font-size: 11px;
|
||||
text-align: center;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
color: darkgray;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.location {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 0.8em;
|
||||
display: block;
|
||||
background-color: cornflowerblue;
|
||||
padding: 10px;
|
||||
margin-left: 7%;
|
||||
margin-right: 7%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 100px) and (max-width: 728px) and (orientation:landscape) {
|
||||
body {
|
||||
width: 100%;
|
||||
margin: 0px;
|
||||
background: url(/img/background.png) fixed no;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
hr {
|
||||
width: 93%;
|
||||
height: 2px;
|
||||
background-color: gainsboro;
|
||||
border: 0px;
|
||||
}
|
||||
.card {
|
||||
margin-top: 6%;
|
||||
margin-left: 9%;
|
||||
margin-right: 0px;
|
||||
background-color: white;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
||||
transition: 0.3s;
|
||||
width: 80%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.card:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 1);
|
||||
}
|
||||
img {
|
||||
border: 15px solid white;
|
||||
margin-bottom: -15% !important;
|
||||
border-radius: 50%;
|
||||
width: 25%;
|
||||
}
|
||||
.name {
|
||||
padding-right: 4px;
|
||||
padding-left: 4px;
|
||||
text-align: center;
|
||||
font-size: 2.8em;
|
||||
color: gainsboro;
|
||||
margin-top: 16%;
|
||||
margin-bottom: auto;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 1.9em;
|
||||
color: darkgray;
|
||||
}
|
||||
.icons {
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
color: darkgray;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.location {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 1.5em;
|
||||
display: block;
|
||||
background-color: cornflowerblue;
|
||||
padding: 10px;
|
||||
margin-left: 7%;
|
||||
margin-right: 7%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 728px) and (max-width: 1000px) {
|
||||
body {
|
||||
width: 100%;
|
||||
margin: 0px;
|
||||
background: url(/img/background.png) fixed no;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
hr {
|
||||
width: 93%;
|
||||
height: 2px;
|
||||
background-color: gainsboro;
|
||||
border: 0px;
|
||||
}
|
||||
.card {
|
||||
margin-top: 4%;
|
||||
margin-left: 13%;
|
||||
align-content: center;
|
||||
background-color: white;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
||||
transition: 0.3s;
|
||||
width: 75%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.card:hover {
|
||||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 1);
|
||||
}
|
||||
img {
|
||||
border: 15px solid white;
|
||||
margin-bottom: -18% !important;
|
||||
border-radius: 50%;
|
||||
width: 30%;
|
||||
}
|
||||
.name {
|
||||
text-align: center;
|
||||
font-size: 2.5em;
|
||||
color: gainsboro;
|
||||
margin-top: 16%;
|
||||
margin-bottom: auto;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
font-size: 2em;
|
||||
color: darkgray;
|
||||
}
|
||||
.icons {
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
color: darkgray;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.location {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 1.8em;
|
||||
display: block;
|
||||
background-color: cornflowerblue;
|
||||
padding: 10px;
|
||||
margin-left: 7%;
|
||||
margin-right: 7%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.fa-stack:hover {
|
||||
transition: 0.9s;
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
|
||||
.fa-lg {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.fa-twitter:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: #1da1f2;
|
||||
}
|
||||
|
||||
.fa-facebook:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: #3b5998;
|
||||
}
|
||||
|
||||
.fa-google-plus:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: #dd4b39;
|
||||
}
|
||||
|
||||
.fa-github:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
.fa-instagram:hover {
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
background-color: #5851db;
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 1.2em
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin-top: 8%;" >
|
||||
<div class="card animated fadeIn">
|
||||
<form method="POST">
|
||||
<hr>
|
||||
<div class="name">
|
||||
<h1>Регистрация</h1>
|
||||
</div>
|
||||
<center><div id="success" class="alert alert-success alert-dismissible" role="alert" style="display:none; width:430px">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<div class="alert-message"></div>
|
||||
</div>
|
||||
<div id="error" class="alert alert-danger alert-dismissible" role="alert" style="display:none; width:430px">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<div class="alert-message"></div>
|
||||
</div>
|
||||
<form id="register">
|
||||
<div class="form-group">
|
||||
<label for="username">Имя</label>
|
||||
<input type="text" name="username" class="form-control" id="username" placeholder="Имя" style="width:430px; height:34px">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Пароль</label>
|
||||
<input type="password" name="password" class="form-control" id="password" placeholder="Пароль" style="width:430px; height:34px">
|
||||
</div>
|
||||
<br>
|
||||
<input type="submit" name="submit" value="Регистрация" class="btn btn-default">
|
||||
|
||||
</input>
|
||||
</form>
|
||||
<br><br>
|
||||
</center>
|
||||
</form>
|
||||
</div>
|
||||
<footer class="animated fadeIn">
|
||||
<p></p>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user