Deck manager start
This commit is contained in:
parent
580f34c754
commit
f2485a5ac6
@ -121,7 +121,7 @@ public class GameUtilitiesProcessor extends Processor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( packet.getHeader().getToken() == 28 ) {
|
if( packet.getHeader().getToken() == 28 ) {
|
||||||
byte[] b = Util.hexStringToByteArray("1252AA064F0A12094743545702000002116739AB040000000012190A170A0A08CE840110021809200012091884B6DAFCCEBDCC02121E0A1C0A0A08CE8401100218082000120E3A0C0D4743545715746174731804");
|
/* byte[] b = Util.hexStringToByteArray("1252AA064F0A12094743545702000002116739AB040000000012190A170A0A08CE840110021809200012091884B6DAFCCEBDCC02121E0A1C0A0A08CE8401100218082000120E3A0C0D4743545715746174731804");
|
||||||
|
|
||||||
Protocol.Header header = Protocol.Header.newBuilder()
|
Protocol.Header header = Protocol.Header.newBuilder()
|
||||||
.setServiceId(5)
|
.setServiceId(5)
|
||||||
@ -132,7 +132,7 @@ public class GameUtilitiesProcessor extends Processor {
|
|||||||
.setStatus(0)
|
.setStatus(0)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
conn.send(new BattleNetPacket(header, b));
|
conn.send(new BattleNetPacket(header, b));*/
|
||||||
} else if( packet.getHeader().getToken() == 34 || packet.getHeader().getToken() == 35 ) {
|
} else if( packet.getHeader().getToken() == 34 || packet.getHeader().getToken() == 35 ) {
|
||||||
|
|
||||||
Protocol.Header header = Processor.generateResponse(0, 12, 0, 0);
|
Protocol.Header header = Processor.generateResponse(0, 12, 0, 0);
|
||||||
|
@ -5,10 +5,7 @@ import com.alterdekim.Protocol;
|
|||||||
import com.alterdekim.hearthhack.component.TcpConnection;
|
import com.alterdekim.hearthhack.component.TcpConnection;
|
||||||
import com.alterdekim.hearthhack.util.BattleNetPacket;
|
import com.alterdekim.hearthhack.util.BattleNetPacket;
|
||||||
import com.alterdekim.hearthhack.util.Util;
|
import com.alterdekim.hearthhack.util.Util;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
@ -44,14 +41,7 @@ public class PresenceProcessor extends Processor {
|
|||||||
.setStatus(0)
|
.setStatus(0)
|
||||||
.build();
|
.build();
|
||||||
// FIRST
|
// FIRST
|
||||||
Protocol.AddNotification addNotification = Protocol.AddNotification.parseFrom(Util.hexStringToByteArray("1A71AA066E0A120900000000000000011193710E1A0000000012190A170A0A08CE84011001180620001209189AB1D8B499BCCC02121A0A180A0A08CE8401100118012000120A2A086A6F686E20626F6E12210A1F0A0A08CE840110011804200012112A0F517569726B794F7263233239363838"));
|
|
||||||
//log.info("AddNotification: {}", addNotification);
|
|
||||||
|
|
||||||
//System.out.println(Util.bytesToHex(bb));
|
|
||||||
|
|
||||||
conn.send(new BattleNetPacket(header, bb));
|
conn.send(new BattleNetPacket(header, bb));
|
||||||
|
|
||||||
|
|
||||||
} else if( subscribeRequest.getObjectId() == 2 ) {
|
} else if( subscribeRequest.getObjectId() == 2 ) {
|
||||||
String ni = conn.getUserService().findById(conn.getUserId()).getDisplayName()+"#66666";
|
String ni = conn.getUserService().findById(conn.getUserId()).getDisplayName()+"#66666";
|
||||||
byte[] nickname = ni.getBytes(StandardCharsets.US_ASCII);
|
byte[] nickname = ni.getBytes(StandardCharsets.US_ASCII);
|
||||||
@ -69,8 +59,6 @@ public class PresenceProcessor extends Processor {
|
|||||||
.setStatus(0)
|
.setStatus(0)
|
||||||
.build();
|
.build();
|
||||||
// SECOND
|
// SECOND
|
||||||
/*Protocol.AddNotification addNotification = Protocol.AddNotification.parseFrom(Util.hexStringToByteArray("1ADB01AA06D7010A12094743545702000002116739AB040000000012210A1F0A0A08CE840110021805200012112A0F517569726B794F726323323936383812240A220A0A08CE8401100218072000121452120900000000000000011193710E1A0000000012190A170A0A08CE84011002180420001209189AB1D8B499BCCC0212120A100A0A08CE84011002180C20001202100012120A100A0A08CE84011002180120001202100012160A140A0A08CE84011002180320001206420457544347121D0A1B0A0A08CE8401100218062000120D2A0B3433373135343139352331"));
|
|
||||||
System.out.println(addNotification);*/
|
|
||||||
|
|
||||||
conn.send(new BattleNetPacket(header, bb));
|
conn.send(new BattleNetPacket(header, bb));
|
||||||
|
|
||||||
@ -89,14 +77,9 @@ public class PresenceProcessor extends Processor {
|
|||||||
case 3:
|
case 3:
|
||||||
header = Processor.generateResponse(0, packet.getHeader().getToken(), 0, 0);
|
header = Processor.generateResponse(0, packet.getHeader().getToken(), 0, 0);
|
||||||
conn.send(new BattleNetPacket(header, new byte[0]));
|
conn.send(new BattleNetPacket(header, new byte[0]));
|
||||||
if( packet.getHeader().getToken() == 12 ) {
|
/* if( packet.getHeader().getToken() == 12 ) {
|
||||||
/* Protocol.Header header1 = Processor.generateResponse(0, packet.getHeader().getToken(), 0, 0);
|
|
||||||
conn.send(new BattleNetPacket(header1, new byte[0]));*/
|
|
||||||
conn.sendRaw(Util.hexStringToByteArray("000c08fe011800200028950130000a0c08f4c9ccf30d10c687bcb805120a0889ff5c1092e5a1b9051800220e0a0c0109080a04030507060211102a2e0a2c0d55450000157a72746d1a206ff4fdd5fa5f6d62a278a04403e075d69d734cd4880732dce8edc6a3f528089230a08a95f4cebdcc02422e0a2c0d55450000157a72746d1a20b4bd0f0096a7648de1d19042fb7a79b96c0df48eea3488f498b08ad3d38fb2cc"));
|
conn.sendRaw(Util.hexStringToByteArray("000c08fe011800200028950130000a0c08f4c9ccf30d10c687bcb805120a0889ff5c1092e5a1b9051800220e0a0c0109080a04030507060211102a2e0a2c0d55450000157a72746d1a206ff4fdd5fa5f6d62a278a04403e075d69d734cd4880732dce8edc6a3f528089230a08a95f4cebdcc02422e0a2c0d55450000157a72746d1a20b4bd0f0096a7648de1d19042fb7a79b96c0df48eea3488f498b08ad3d38fb2cc"));
|
||||||
} else if( packet.getHeader().getToken() == 13 ) {
|
} else if( packet.getHeader().getToken() == 13 ) {
|
||||||
/* Protocol.Header header1 = Processor.generateResponse(0, packet.getHeader().getToken(), 0, 0);
|
|
||||||
conn.send(new BattleNetPacket(header1, new byte[0]));*/
|
|
||||||
|
|
||||||
Protocol.Header header1 = Protocol.Header.newBuilder()
|
Protocol.Header header1 = Protocol.Header.newBuilder()
|
||||||
.setServiceId(5)
|
.setServiceId(5)
|
||||||
.setMethodId(6)
|
.setMethodId(6)
|
||||||
@ -108,9 +91,6 @@ public class PresenceProcessor extends Processor {
|
|||||||
|
|
||||||
conn.send(new BattleNetPacket(header1, Util.hexStringToByteArray("1233AA06300A12094743545702000002116739AB0400000000121A0A180A0A08C786D1BA0510021813120A2A083833383836303830")));
|
conn.send(new BattleNetPacket(header1, Util.hexStringToByteArray("1233AA06300A12094743545702000002116739AB0400000000121A0A180A0A08C786D1BA0510021813120A2A083833383836303830")));
|
||||||
} else if( packet.getHeader().getToken() == 18 ) {
|
} else if( packet.getHeader().getToken() == 18 ) {
|
||||||
/* Protocol.Header header1 = Processor.generateResponse(0, packet.getHeader().getToken(), 0, 0);
|
|
||||||
conn.send(new BattleNetPacket(header1, new byte[0]));*/
|
|
||||||
|
|
||||||
byte[] b = Util.hexStringToByteArray("122BAA06280A12094743545702000002116739AB040000000012120A100A0A08C786D1BA051002180112021000");
|
byte[] b = Util.hexStringToByteArray("122BAA06280A12094743545702000002116739AB040000000012120A100A0A08C786D1BA051002180112021000");
|
||||||
|
|
||||||
Protocol.Header header1 = Protocol.Header.newBuilder()
|
Protocol.Header header1 = Protocol.Header.newBuilder()
|
||||||
@ -123,24 +103,7 @@ public class PresenceProcessor extends Processor {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
conn.send(new BattleNetPacket(header1, b));
|
conn.send(new BattleNetPacket(header1, b));
|
||||||
|
|
||||||
/* b = Util.hexStringToByteArray("0A120900000000000000021100000000000000001212094743545702000002116739AB04000000001A1C575443472E5574696C4E6F74696669636174696F6E4D65737361676522130A0C6D6573736167655F74797065120318CA0222140A0C667261676D656E745F30303012043202080122120A0C6D6573736167655F73697A65120218022A1209000000000000000111000000000000000032120900000000000000011193710E1A000000003A004A0A0889FF5C1092E5A1B90552150A050D93710E1A120C0D6739AB0415474354571802");
|
|
||||||
|
|
||||||
header = Protocol.Header.newBuilder()
|
|
||||||
.setServiceId(4)
|
|
||||||
.setMethodId(1)
|
|
||||||
.setToken(conn.nextToken())
|
|
||||||
.setObjectId(0)
|
|
||||||
.setSize(b.length)
|
|
||||||
.setStatus(0)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
conn.send(new BattleNetPacket(header, b));*/
|
|
||||||
|
|
||||||
} else if( packet.getHeader().getToken() == 26 ) {
|
} else if( packet.getHeader().getToken() == 26 ) {
|
||||||
/* Protocol.Header header1 = Processor.generateResponse(0, packet.getHeader().getToken(), 0, 0);
|
|
||||||
conn.send(new BattleNetPacket(header1, new byte[0]));*/
|
|
||||||
|
|
||||||
byte[] b = Util.hexStringToByteArray("1231AA062E0A12094743545702000002116739AB040000000012180A160A0A08C786D1BA051002181212083206190000190000");
|
byte[] b = Util.hexStringToByteArray("1231AA062E0A12094743545702000002116739AB040000000012180A160A0A08C786D1BA051002181212083206190000190000");
|
||||||
|
|
||||||
header = Protocol.Header.newBuilder()
|
header = Protocol.Header.newBuilder()
|
||||||
@ -154,12 +117,7 @@ public class PresenceProcessor extends Processor {
|
|||||||
|
|
||||||
conn.send(new BattleNetPacket(header, b));
|
conn.send(new BattleNetPacket(header, b));
|
||||||
} else if( packet.getHeader().getToken() == 32 ) {
|
} else if( packet.getHeader().getToken() == 32 ) {
|
||||||
byte[] b = Util.hexStringToByteArray("0D5545000015737368001A20BEC5292231D7686AF00CE64E0C58CC6E360EA950AAFFAC6A114F03A958E275F3");
|
byte[] b = Util.hexStringToByteArray("1230AA062D0A12094743545702000002116739AB040000000012170A150A0A08C786D1BA0510021811120732050103000000");
|
||||||
|
|
||||||
Protocol.Header header1 = Processor.generateResponse(b.length, packet.getHeader().getToken(), 0, 0);
|
|
||||||
//conn.send(new BattleNetPacket(header1, b));
|
|
||||||
|
|
||||||
b = Util.hexStringToByteArray("1230AA062D0A12094743545702000002116739AB040000000012170A150A0A08C786D1BA0510021811120732050103000000");
|
|
||||||
|
|
||||||
header = Protocol.Header.newBuilder()
|
header = Protocol.Header.newBuilder()
|
||||||
.setServiceId(5)
|
.setServiceId(5)
|
||||||
@ -170,29 +128,7 @@ public class PresenceProcessor extends Processor {
|
|||||||
.setStatus(0)
|
.setStatus(0)
|
||||||
.build();
|
.build();
|
||||||
conn.send(new BattleNetPacket(header, b));
|
conn.send(new BattleNetPacket(header, b));
|
||||||
} else if( packet.getHeader().getToken() == 33 ) {
|
}*/
|
||||||
byte[] b = Util.hexStringToByteArray("0D5545000015737368001A20BEC5292231D7686AF00CE64E0C58CC6E360EA950AAFFAC6A114F03A958E275F3");
|
|
||||||
|
|
||||||
Protocol.Header header1 = Processor.generateResponse(b.length, packet.getHeader().getToken(), 0, 0);
|
|
||||||
// conn.send(new BattleNetPacket(header1, b));
|
|
||||||
} else if( packet.getHeader().getToken() == 36 ) {
|
|
||||||
byte[] b = Util.hexStringToByteArray("0A090A026964120318C6020A120A0570726F746F12093207080110C9011806");
|
|
||||||
|
|
||||||
Protocol.Header header1 = Processor.generateResponse(b.length, packet.getHeader().getToken(), 0, 0);
|
|
||||||
// conn.send(new BattleNetPacket(header1, b));
|
|
||||||
|
|
||||||
/* b = Util.hexStringToByteArray("0A120900000000000000021100000000000000001212094743545702000002116739AB04000000001A1C575443472E5574696C4E6F74696669636174696F6E4D65737361676522130A0C6D6573736167655F74797065120318E00122120A0C6D6573736167655F73697A65120218002A1209000000000000000111000000000000000032120900000000000000011193710E1A000000003A004A0A0889FF5C1092E5A1B90552150A050D93710E1A120C0D6739AB0415474354571802");
|
|
||||||
|
|
||||||
header = Protocol.Header.newBuilder()
|
|
||||||
.setServiceId(4)
|
|
||||||
.setMethodId(1)
|
|
||||||
.setToken(conn.nextToken())
|
|
||||||
.setObjectId(0)
|
|
||||||
.setSize(b.length)
|
|
||||||
.setStatus(0)
|
|
||||||
.build();
|
|
||||||
conn.send(new BattleNetPacket(header, b));*/
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
log.error("Can't process weird PresenceProcessor method: " + packet.getHeader().getMethodId());
|
log.error("Can't process weird PresenceProcessor method: " + packet.getHeader().getMethodId());
|
||||||
|
File diff suppressed because one or more lines are too long
@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.alterdekim.hearthhack.util.GameUtilities.generateNotification;
|
import static com.alterdekim.hearthhack.util.GameUtilities.generateNotification;
|
||||||
|
|
||||||
@ -20,56 +21,28 @@ public class GetDeck extends ClientRequestParser {
|
|||||||
public void parse(BattleNetPacket packet, ClientRequestBody body, TcpConnection conn) throws Exception {
|
public void parse(BattleNetPacket packet, ClientRequestBody body, TcpConnection conn) throws Exception {
|
||||||
Protocol.GetDeckContents request = Protocol.GetDeckContents.parseFrom(body.getBody());
|
Protocol.GetDeckContents request = Protocol.GetDeckContents.parseFrom(body.getBody());
|
||||||
|
|
||||||
List<Protocol.DeckCardData> ddl = new ArrayList<>();
|
|
||||||
for( int i = 0; i < 10; i++ ) {
|
|
||||||
ddl.add(Protocol.DeckCardData.newBuilder()
|
|
||||||
.setDef(Protocol.CardDef.newBuilder().setAsset(242)).setHandle(0).setQty(2).setPrev(0).build());
|
|
||||||
}
|
|
||||||
for( int i = 0; i < 10; i++ ) {
|
|
||||||
ddl.add(Protocol.DeckCardData.newBuilder()
|
|
||||||
.setDef(Protocol.CardDef.newBuilder().setAsset(670)).setHandle(0).setQty(2).setPrev(0).build());
|
|
||||||
}
|
|
||||||
for( int i = 0; i < 5; i++ ) {
|
|
||||||
ddl.add(Protocol.DeckCardData.newBuilder()
|
|
||||||
.setDef(Protocol.CardDef.newBuilder().setAsset(555)).setHandle(0).setQty(2).setPrev(0).build());
|
|
||||||
}
|
|
||||||
for( int i = 0; i < 5; i++ ) {
|
|
||||||
ddl.add(Protocol.DeckCardData.newBuilder()
|
|
||||||
.setDef(Protocol.CardDef.newBuilder().setAsset(289)).setHandle(0).setQty(2).setPrev(0).build());
|
|
||||||
}
|
|
||||||
Protocol.GetDeckContentsResponse.Builder deckContentsResponse = Protocol.GetDeckContentsResponse.newBuilder();
|
Protocol.GetDeckContentsResponse.Builder deckContentsResponse = Protocol.GetDeckContentsResponse.newBuilder();
|
||||||
|
List<Protocol.DeckCardData> l;
|
||||||
for( long id : request.getDeckIdList() ) {
|
for( long id : request.getDeckIdList() ) {
|
||||||
|
l = conn.getUserService().getDeckContentForDeckId(conn.getUserId(), id)
|
||||||
|
.stream()
|
||||||
|
.map(c -> Protocol.DeckCardData.newBuilder()
|
||||||
|
.setQty(1)
|
||||||
|
.setHandle(0)
|
||||||
|
.setPrev(0)
|
||||||
|
.setDef(Protocol.CardDef.newBuilder()
|
||||||
|
.setPremium(c.getIsPremium() ? 1 : 0)
|
||||||
|
.setAsset(c.getAssetId().intValue()))
|
||||||
|
.build())
|
||||||
|
.collect(Collectors.toList());
|
||||||
deckContentsResponse.addDecks(
|
deckContentsResponse.addDecks(
|
||||||
Protocol.DeckContents.newBuilder()
|
Protocol.DeckContents.newBuilder()
|
||||||
.setSuccess(true)
|
.setSuccess(true)
|
||||||
.setDeckId(id)
|
.setDeckId(id)
|
||||||
.addAllCards(ddl)
|
.addAllCards(l)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Protocol.GetDeckContentsResponse dd = deckContentsResponse.build();
|
||||||
// Protocol.GetDeckContentsResponse dd = deckContentsResponse.build();
|
|
||||||
|
|
||||||
// Protocol.Notification n = generateNotification(215,
|
|
||||||
// dd.toByteString(),
|
|
||||||
// dd.getSerializedSize());
|
|
||||||
|
|
||||||
/* Protocol.Header header = Protocol.Header.newBuilder()
|
|
||||||
.setServiceId(4)
|
|
||||||
.setMethodId(1)
|
|
||||||
.setToken(conn.nextToken())
|
|
||||||
.setObjectId(0)
|
|
||||||
.setSize(n.getSerializedSize())
|
|
||||||
.setStatus(0)
|
|
||||||
.build();*/
|
|
||||||
|
|
||||||
// conn.send(new BattleNetPacket(header, n.toByteArray()));
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////
|
|
||||||
|
|
||||||
byte[] bb = Util.hexStringToByteArray("08CFED81FB02120D0A05089E051000100018022800120D0A0508AB041000100018022800120C0A04084D1000100018022800120D0A0508FB041000100018022800120D0A0508A1021000100018022800120D0A0508BB021000100018022800120D0A05089C021000100018022800120D0A0508BF011000100018022800120D0A0508DA0A1000100018022800120D0A0508BF031000100018022800120D0A0508960D1000100018022800120D0A0508F90A1000100018022800120D0A0508D8011000100018022800120D0A0508D90A1000100018022800120D0A0508B40410001000180228001AE801080110CFED81FB021A0D0A05089E0510001000180228001A0D0A0508AB0410001000180228001A0C0A04084D10001000180228001A0D0A0508FB0410001000180228001A0D0A0508A10210001000180228001A0D0A0508BB0210001000180228001A0D0A05089C0210001000180228001A0D0A0508BF0110001000180228001A0D0A0508DA0A10001000180228001A0D0A0508BF0310001000180228001A0D0A0508960D10001000180228001A0D0A0508F90A10001000180228001A0D0A0508D80110001000180228001A0D0A0508D90A10001000180228001A0D0A0508B40410001000180228001AE801080110969787FB021A0D0A0508EB0710001000180228001A0D0A0508DE0410001000180228001A0D0A0508970810001000180228001A0C0A04084310001000180228001A0D0A0508970D10001000180228001A0D0A0508D30210001000180228001A0D0A0508880510001000180228001A0D0A05089D0310001000180228001A0D0A0508810210001000180228001A0D0A0508DA0A10001000180228001A0D0A0508F90A10001000180228001A0D0A0508A40210001000180228001A0D0A0508D80110001000180228001A0D0A0508ED0610001000180228001A0D0A0508D90A1000100018022800");
|
|
||||||
|
|
||||||
|
|
||||||
Protocol.ClientResponse clResponse = Protocol.ClientResponse.newBuilder()
|
Protocol.ClientResponse clResponse = Protocol.ClientResponse.newBuilder()
|
||||||
.addAttribute(Protocol.Attribute.newBuilder()
|
.addAttribute(Protocol.Attribute.newBuilder()
|
||||||
@ -80,7 +53,7 @@ public class GetDeck extends ClientRequestParser {
|
|||||||
.addAttribute(Protocol.Attribute.newBuilder()
|
.addAttribute(Protocol.Attribute.newBuilder()
|
||||||
.setName("proto")
|
.setName("proto")
|
||||||
.setValue(Protocol.Variant.newBuilder()
|
.setValue(Protocol.Variant.newBuilder()
|
||||||
.setBlobValue(ByteString.copyFrom(bb))
|
.setBlobValue(dd.toByteString())
|
||||||
))
|
))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.alterdekim.hearthhack.component.processor.client.request;
|
||||||
|
|
||||||
|
import com.alterdekim.Protocol;
|
||||||
|
import com.alterdekim.hearthhack.component.TcpConnection;
|
||||||
|
import com.alterdekim.hearthhack.util.BattleNetPacket;
|
||||||
|
import com.alterdekim.hearthhack.util.ClientRequestBody;
|
||||||
|
|
||||||
|
import static com.alterdekim.hearthhack.util.GameUtilities.generateNotification;
|
||||||
|
|
||||||
|
public class RenameDeck extends ClientRequestParser {
|
||||||
|
@Override
|
||||||
|
public void parse(BattleNetPacket packet, ClientRequestBody body, TcpConnection conn) throws Exception {
|
||||||
|
Protocol.RenameDeck request = Protocol.RenameDeck.parseFrom(body.getBody());
|
||||||
|
|
||||||
|
conn.getUserService().updateDeckName(conn.getUserId(), request.getDeck(), request.getName());
|
||||||
|
|
||||||
|
Protocol.DeckRenamed renamed = Protocol.DeckRenamed.newBuilder()
|
||||||
|
.setDeck(request.getDeck())
|
||||||
|
.setName(request.getName())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Protocol.Notification n = generateNotification(219, renamed.toByteString(), renamed.getSerializedSize());
|
||||||
|
|
||||||
|
Protocol.Header header = Protocol.Header.newBuilder()
|
||||||
|
.setServiceId(4)
|
||||||
|
.setMethodId(1)
|
||||||
|
.setToken(conn.nextToken())
|
||||||
|
.setObjectId(0)
|
||||||
|
.setSize(n.getSerializedSize())
|
||||||
|
.setStatus(0)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
conn.send(new BattleNetPacket(header, n.toByteArray()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return 211;
|
||||||
|
}
|
||||||
|
}
|
@ -20,6 +20,15 @@ public class AvailableFeatures extends GenericParser {
|
|||||||
private void executeFeatures(TcpConnection conn) throws Exception {
|
private void executeFeatures(TcpConnection conn) throws Exception {
|
||||||
Protocol.GuardianVars guardianVars = Protocol.GuardianVars.newBuilder()
|
Protocol.GuardianVars guardianVars = Protocol.GuardianVars.newBuilder()
|
||||||
.setShowUserUi(1)
|
.setShowUserUi(1)
|
||||||
|
.setMage(true)
|
||||||
|
.setManager(true)
|
||||||
|
.setPriest(true)
|
||||||
|
.setWarlock(true)
|
||||||
|
.setWarrior(true)
|
||||||
|
.setRogue(true)
|
||||||
|
.setHunter(true)
|
||||||
|
.setPaladin(true)
|
||||||
|
.setShaman(true)
|
||||||
.setClientOptionsUpdateIntervalSeconds(300)
|
.setClientOptionsUpdateIntervalSeconds(300)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@ -36,18 +45,6 @@ public class AvailableFeatures extends GenericParser {
|
|||||||
|
|
||||||
conn.send(new BattleNetPacket(header, n.toByteArray()));
|
conn.send(new BattleNetPacket(header, n.toByteArray()));
|
||||||
|
|
||||||
/* byte[] b = Util.hexStringToByteArray("0A120900000000000000021100000000000000001212094743545702000002116739AB04000000001A1C575443472E5574696C4E6F74696669636174696F6E4D65737361676522130A0C6D6573736167655F74797065120318E00122120A0C6D6573736167655F73697A65120218002A1209000000000000000111000000000000000032120900000000000000011193710E1A000000003A004A0A0889FF5C1092E5A1B90552150A050D93710E1A120C0D6739AB0415474354571802");
|
|
||||||
|
|
||||||
header = Protocol.Header.newBuilder()
|
|
||||||
.setServiceId(4)
|
|
||||||
.setMethodId(1)
|
|
||||||
.setToken(conn.nextToken())
|
|
||||||
.setObjectId(0)
|
|
||||||
.setSize(b.length)
|
|
||||||
.setStatus(0)
|
|
||||||
.build();
|
|
||||||
conn.send(new BattleNetPacket(header, b));*/
|
|
||||||
|
|
||||||
List<Protocol.BoosterInfo> binfo = conn.getUserService().getBoostersByUserId(conn.getUserId()).stream().map(b -> Protocol.BoosterInfo.newBuilder()
|
List<Protocol.BoosterInfo> binfo = conn.getUserService().getBoostersByUserId(conn.getUserId()).stream().map(b -> Protocol.BoosterInfo.newBuilder()
|
||||||
.setCount(b.getCount())
|
.setCount(b.getCount())
|
||||||
.setType(b.getType())
|
.setType(b.getType())
|
||||||
|
@ -2,6 +2,7 @@ package com.alterdekim.hearthhack.component.processor.client.request.generic;
|
|||||||
|
|
||||||
import com.alterdekim.Protocol;
|
import com.alterdekim.Protocol;
|
||||||
import com.alterdekim.hearthhack.component.TcpConnection;
|
import com.alterdekim.hearthhack.component.TcpConnection;
|
||||||
|
import com.alterdekim.hearthhack.game.ServerOption;
|
||||||
import com.alterdekim.hearthhack.util.BattleNetPacket;
|
import com.alterdekim.hearthhack.util.BattleNetPacket;
|
||||||
|
|
||||||
import static com.alterdekim.hearthhack.util.GameUtilities.generateNotification;
|
import static com.alterdekim.hearthhack.util.GameUtilities.generateNotification;
|
||||||
@ -13,25 +14,25 @@ public class ClientOptions extends GenericParser {
|
|||||||
public void parseGenericRequest(int token, TcpConnection conn) throws Exception {
|
public void parseGenericRequest(int token, TcpConnection conn) throws Exception {
|
||||||
Protocol.ClientOptions clientOptions = Protocol.ClientOptions.newBuilder()
|
Protocol.ClientOptions clientOptions = Protocol.ClientOptions.newBuilder()
|
||||||
.addOptions(Protocol.ClientOption.newBuilder()
|
.addOptions(Protocol.ClientOption.newBuilder()
|
||||||
.setIndex(24)
|
.setIndex(ServerOption.SERVER_OPTIONS_VERSION.ordinal())
|
||||||
.setAsInt32(3))
|
.setAsInt32(3))
|
||||||
.addOptions(Protocol.ClientOption.newBuilder()
|
.addOptions(Protocol.ClientOption.newBuilder()
|
||||||
.setIndex(1)
|
.setIndex(ServerOption.FLAGS1.ordinal())
|
||||||
.setAsUint64(13514148956663808L))
|
.setAsUint64(13514148956663808L))
|
||||||
.addOptions(Protocol.ClientOption.newBuilder()
|
.addOptions(Protocol.ClientOption.newBuilder()
|
||||||
.setIndex(2)
|
.setIndex(ServerOption.FLAGS2.ordinal())
|
||||||
.setAsUint64(549755813888L))
|
.setAsUint64(549755813888L))
|
||||||
.addOptions(Protocol.ClientOption.newBuilder()
|
.addOptions(Protocol.ClientOption.newBuilder()
|
||||||
.setIndex(20)
|
.setIndex(ServerOption.SELECTED_ADVENTURE.ordinal())
|
||||||
.setAsInt32(2))
|
.setAsInt32(2))
|
||||||
.addOptions(Protocol.ClientOption.newBuilder()
|
.addOptions(Protocol.ClientOption.newBuilder()
|
||||||
.setIndex(21)
|
.setIndex(ServerOption.SELECTED_ADVENTURE_MODE.ordinal())
|
||||||
.setAsInt32(1))
|
.setAsInt32(1))
|
||||||
.addOptions(Protocol.ClientOption.newBuilder()
|
.addOptions(Protocol.ClientOption.newBuilder()
|
||||||
.setIndex(8)
|
.setIndex(ServerOption.LAST_PRECON_HERO_CHOSEN.ordinal())
|
||||||
.setAsInt32(4))
|
.setAsInt32(4))
|
||||||
.addOptions(Protocol.ClientOption.newBuilder()
|
.addOptions(Protocol.ClientOption.newBuilder()
|
||||||
.setIndex(10)
|
.setIndex(ServerOption.TIP_PRACTICE_PROGRESS.ordinal())
|
||||||
.setAsInt32(1))
|
.setAsInt32(1))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -3,67 +3,62 @@ package com.alterdekim.hearthhack.component.processor.client.request.generic;
|
|||||||
import com.alterdekim.Protocol;
|
import com.alterdekim.Protocol;
|
||||||
import com.alterdekim.hearthhack.component.TcpConnection;
|
import com.alterdekim.hearthhack.component.TcpConnection;
|
||||||
import com.alterdekim.hearthhack.util.BattleNetPacket;
|
import com.alterdekim.hearthhack.util.BattleNetPacket;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.alterdekim.hearthhack.util.GameUtilities.generateNotification;
|
import static com.alterdekim.hearthhack.util.GameUtilities.generateNotification;
|
||||||
import static com.alterdekim.hearthhack.util.GetAccountInfoRequest.DECK_LIST;
|
import static com.alterdekim.hearthhack.util.GetAccountInfoRequest.DECK_LIST;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
public class DeckList extends GenericParser {
|
public class DeckList extends GenericParser {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void parseGenericRequest(int token, TcpConnection conn) throws Exception {
|
public void parseGenericRequest(int token, TcpConnection conn) throws Exception {
|
||||||
Protocol.DeckList deckList = Protocol.DeckList.newBuilder()
|
List<Protocol.DeckInfo> l = conn.getUserService().getDecksForUser(conn.getUserId())
|
||||||
.addDecks(Protocol.DeckInfo.newBuilder()
|
.stream()
|
||||||
.setId(794851023L)
|
.map(d -> Protocol.DeckInfo.newBuilder()
|
||||||
.setName("The Fuck")
|
.setId(d.getId())
|
||||||
.setCardBack(0)
|
.setName(d.getName())
|
||||||
.setHero(637)
|
.setCardBack(conn.getUserService().getCardBackById(d.getCardBack()).getBackId())
|
||||||
.setDeckType(Protocol.DeckType.NORMAL_DECK)
|
.setHero(d.getHero())
|
||||||
|
.setDeckType(Protocol.DeckType.forNumber(d.getDeckType()))
|
||||||
.setValidity(767L)
|
.setValidity(767L)
|
||||||
.setHeroPremium(0)
|
.setHeroPremium(d.getHeroPremium() ? 1 : 0)
|
||||||
.setCardBackOverride(false)
|
.setCardBackOverride(d.getCardBackOverride())
|
||||||
.setHeroOverride(false)
|
.setHeroOverride(d.getHeroOverride())
|
||||||
.setLastModified(1461490210L)
|
.setLastModified(d.getLastModified())
|
||||||
.setSortOrder(1461490210L)
|
.setSortOrder(d.getSortOrder())
|
||||||
.setSourceType(Protocol.DeckSourceType.DECK_SOURCE_TYPE_BASIC_DECK))
|
.setSourceType(Protocol.DeckSourceType.forNumber(d.getSourceType()))
|
||||||
.addDecks(Protocol.DeckInfo.newBuilder()
|
.build())
|
||||||
.setId(794938262L)
|
.collect(Collectors.toList());
|
||||||
.setName("The Cock")
|
l.add(Protocol.DeckInfo.newBuilder()
|
||||||
.setCardBack(0)
|
.setId(171593L)
|
||||||
.setHero(31)
|
.setName("precon")
|
||||||
.setDeckType(Protocol.DeckType.NORMAL_DECK)
|
.setCardBack(0)
|
||||||
.setValidity(767L)
|
.setHero(637)
|
||||||
.setHeroPremium(0)
|
.setDeckType(Protocol.DeckType.PRECON_DECK)
|
||||||
.setCardBackOverride(false)
|
.setValidity(31L)
|
||||||
.setHeroOverride(false)
|
.setHeroPremium(0)
|
||||||
.setLastModified(1461490581L)
|
.setCardBackOverride(false)
|
||||||
.setSortOrder(1461490581L)
|
.setHeroOverride(false)
|
||||||
.setSourceType(Protocol.DeckSourceType.DECK_SOURCE_TYPE_BASIC_DECK))
|
.setSortOrder(0L)
|
||||||
.addDecks(Protocol.DeckInfo.newBuilder()
|
.setSourceType(Protocol.DeckSourceType.DECK_SOURCE_TYPE_UNKNOWN).build());
|
||||||
.setId(172325L)
|
l.add(Protocol.DeckInfo.newBuilder()
|
||||||
.setName("precon")
|
.setId(172325L)
|
||||||
.setCardBack(0)
|
.setName("precon")
|
||||||
.setHero(31)
|
.setCardBack(0)
|
||||||
.setDeckType(Protocol.DeckType.PRECON_DECK)
|
.setHero(31)
|
||||||
.setValidity(31L)
|
.setDeckType(Protocol.DeckType.PRECON_DECK)
|
||||||
.setHeroPremium(0)
|
.setValidity(31L)
|
||||||
.setCardBackOverride(false)
|
.setHeroPremium(0)
|
||||||
.setHeroOverride(false)
|
.setCardBackOverride(false)
|
||||||
.setSortOrder(0L)
|
.setHeroOverride(false)
|
||||||
.setSourceType(Protocol.DeckSourceType.DECK_SOURCE_TYPE_UNKNOWN))
|
.setSortOrder(0L)
|
||||||
.addDecks(Protocol.DeckInfo.newBuilder()
|
.setSourceType(Protocol.DeckSourceType.DECK_SOURCE_TYPE_UNKNOWN).build());
|
||||||
.setId(171593L)
|
|
||||||
.setName("precon")
|
|
||||||
.setCardBack(0)
|
|
||||||
.setHero(637)
|
|
||||||
.setDeckType(Protocol.DeckType.PRECON_DECK)
|
|
||||||
.setValidity(31L)
|
|
||||||
.setHeroPremium(0)
|
|
||||||
.setCardBackOverride(false)
|
|
||||||
.setHeroOverride(false)
|
|
||||||
.setSortOrder(0L)
|
|
||||||
.setSourceType(Protocol.DeckSourceType.DECK_SOURCE_TYPE_UNKNOWN))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
|
Protocol.DeckList deckList = Protocol.DeckList.newBuilder().addAllDecks(l).build();
|
||||||
Protocol.Notification n = generateNotification(202, deckList.toByteString(), deckList.getSerializedSize());
|
Protocol.Notification n = generateNotification(202, deckList.toByteString(), deckList.getSerializedSize());
|
||||||
|
|
||||||
Protocol.Header header = Protocol.Header.newBuilder()
|
Protocol.Header header = Protocol.Header.newBuilder()
|
||||||
|
@ -25,7 +25,7 @@ public class Deck {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private Integer cardBack;
|
private Long cardBack;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private Integer hero;
|
private Integer hero;
|
||||||
@ -34,10 +34,7 @@ public class Deck {
|
|||||||
private Integer deckType;
|
private Integer deckType;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private Long validity;
|
private Boolean heroPremium;
|
||||||
|
|
||||||
@Column(nullable = false)
|
|
||||||
private Integer heroPremium;
|
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private Boolean cardBackOverride;
|
private Boolean cardBackOverride;
|
||||||
@ -45,9 +42,26 @@ public class Deck {
|
|||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private Boolean heroOverride;
|
private Boolean heroOverride;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Long lastModified;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private Long sortOrder;
|
private Long sortOrder;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private Integer sourceType;
|
private Integer sourceType;
|
||||||
|
|
||||||
|
public Deck(Long userId, String name, Long cardBack, Integer hero, Integer deckType, Boolean heroPremium, Boolean cardBackOverride, Boolean heroOverride, Long lastModified, Long sortOrder, Integer sourceType) {
|
||||||
|
this.userId = userId;
|
||||||
|
this.name = name;
|
||||||
|
this.cardBack = cardBack;
|
||||||
|
this.hero = hero;
|
||||||
|
this.deckType = deckType;
|
||||||
|
this.heroPremium = heroPremium;
|
||||||
|
this.cardBackOverride = cardBackOverride;
|
||||||
|
this.heroOverride = heroOverride;
|
||||||
|
this.lastModified = lastModified;
|
||||||
|
this.sortOrder = sortOrder;
|
||||||
|
this.sourceType = sourceType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.alterdekim.hearthhack.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@ToString
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = "deck_content")
|
||||||
|
public class DeckContent {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(nullable=false)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Column(nullable=false)
|
||||||
|
private Long deckId;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Long assetId;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Boolean isPremium;
|
||||||
|
|
||||||
|
public DeckContent(Long userId, Long deckId, Long assetId, Boolean isPremium) {
|
||||||
|
this.userId = userId;
|
||||||
|
this.deckId = deckId;
|
||||||
|
this.assetId = assetId;
|
||||||
|
this.isPremium = isPremium;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.alterdekim.hearthhack.game;
|
||||||
|
|
||||||
|
public enum ServerOption {
|
||||||
|
INVALID,
|
||||||
|
FLAGS1,
|
||||||
|
FLAGS2,
|
||||||
|
FLAGS3,
|
||||||
|
FLAGS4,
|
||||||
|
FLAGS5,
|
||||||
|
PAGE_MOUSE_OVERS,
|
||||||
|
COVER_MOUSE_OVERS,
|
||||||
|
LAST_PRECON_HERO_CHOSEN,
|
||||||
|
AI_MODE,
|
||||||
|
TIP_PRACTICE_PROGRESS,
|
||||||
|
TIP_PLAY_PROGRESS,
|
||||||
|
TIP_FORGE_PROGRESS,
|
||||||
|
FLAGS6,
|
||||||
|
FLAGS7,
|
||||||
|
FLAGS8,
|
||||||
|
FLAGS9,
|
||||||
|
FLAGS10,
|
||||||
|
LAST_CUSTOM_DECK_CHOSEN,
|
||||||
|
DEPRECATED_DECK_PICKER_MODE,
|
||||||
|
SELECTED_ADVENTURE,
|
||||||
|
SELECTED_ADVENTURE_MODE,
|
||||||
|
LAST_SELECTED_STORE_BOOSTER_ID,
|
||||||
|
LAST_SELECTED_STORE_ADVENTURE_ID,
|
||||||
|
SERVER_OPTIONS_VERSION,
|
||||||
|
LATEST_SEEN_TAVERNBRAWL_SEASON,
|
||||||
|
LATEST_SEEN_TAVERNBRAWL_SEASON_CHALKBOARD,
|
||||||
|
LAST_SELECTED_STORE_HERO_ID,
|
||||||
|
TIMES_SEEN_TAVERNBRAWL_CRAZY_RULES_QUOTE,
|
||||||
|
SKIP_DECK_TEMPLATE_PAGE_FOR_CLASS_FLAGS,
|
||||||
|
SET_ROTATION_INTRO_PROGRESS,
|
||||||
|
TIMES_MOUSED_OVER_SWITCH_FORMAT_BUTTON,
|
||||||
|
LIMIT //= 51
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.alterdekim.hearthhack.repository;
|
||||||
|
|
||||||
|
import com.alterdekim.hearthhack.entity.Deck;
|
||||||
|
import com.alterdekim.hearthhack.entity.DeckContent;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface DeckContentRepository extends JpaRepository<DeckContent, Long> {
|
||||||
|
|
||||||
|
@Query(value = "SELECT new DeckContent(d.id, d.userId, d.deckId, d.assetId, d.isPremium) FROM DeckContent d WHERE d.userId = :userId AND d.deckId = :deckId")
|
||||||
|
List<DeckContent> findCardsByDeckId(@Param("userId") Long userId, @Param("deckId") Long deckId);
|
||||||
|
}
|
@ -3,8 +3,22 @@ package com.alterdekim.hearthhack.repository;
|
|||||||
import com.alterdekim.hearthhack.entity.Deck;
|
import com.alterdekim.hearthhack.entity.Deck;
|
||||||
import com.alterdekim.hearthhack.entity.HeroXP;
|
import com.alterdekim.hearthhack.entity.HeroXP;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface DeckRepository extends JpaRepository<Deck, Long> {
|
public interface DeckRepository extends JpaRepository<Deck, Long> {
|
||||||
|
|
||||||
|
@Query(value = "SELECT new Deck(d.id, d.userId, d.name, d.cardBack, d.hero, d.deckType, d.heroPremium, d.cardBackOverride, d.heroOverride, d.lastModified, d.sortOrder, d.sourceType) FROM Deck d WHERE d.userId = :userId")
|
||||||
|
List<Deck> findDecksByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
@Query(value = "UPDATE Deck d SET d.name = :deckName WHERE d.userId = :userId AND d.id = :deckId")
|
||||||
|
@Transactional
|
||||||
|
@Modifying
|
||||||
|
void updateDeckName(@Param("userId") Long userId, @Param("deckId") Long deckId, @Param("deckName") String name);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.alterdekim.hearthhack.service;
|
package com.alterdekim.hearthhack.service;
|
||||||
|
|
||||||
|
import com.alterdekim.Protocol;
|
||||||
import com.alterdekim.hearthhack.dto.BoosterDTO;
|
import com.alterdekim.hearthhack.dto.BoosterDTO;
|
||||||
import com.alterdekim.hearthhack.dto.UserCardDTO;
|
import com.alterdekim.hearthhack.dto.UserCardDTO;
|
||||||
import com.alterdekim.hearthhack.dto.UserDTO;
|
import com.alterdekim.hearthhack.dto.UserDTO;
|
||||||
@ -24,6 +25,7 @@ public class UserService implements IService {
|
|||||||
private final PasswordEncoder passwordEncoder;
|
private final PasswordEncoder passwordEncoder;
|
||||||
private final HeroXPRepository heroXPRepository;
|
private final HeroXPRepository heroXPRepository;
|
||||||
private final DeckRepository deckRepository;
|
private final DeckRepository deckRepository;
|
||||||
|
private final DeckContentRepository deckContentRepository;
|
||||||
private final CardBackRepository cardBackRepository;
|
private final CardBackRepository cardBackRepository;
|
||||||
private final BoosterRepository boosterRepository;
|
private final BoosterRepository boosterRepository;
|
||||||
private final UserCardRepository userCardRepository;
|
private final UserCardRepository userCardRepository;
|
||||||
@ -43,8 +45,22 @@ public class UserService implements IService {
|
|||||||
CardBack back = new CardBack(0, user.getId());
|
CardBack back = new CardBack(0, user.getId());
|
||||||
cardBackRepository.save(back);
|
cardBackRepository.save(back);
|
||||||
userRepository.updateCardBackOfUser(user.getId(), back.getId());
|
userRepository.updateCardBackOfUser(user.getId(), back.getId());
|
||||||
|
boosterRepository.save(new Booster(user.getId(), 10));
|
||||||
|
Deck d = deckRepository.save(new Deck(user.getId(), "Hunter", 0L, 637, Protocol.DeckType.NORMAL_DECK.getNumber(), false, false, false, 1461490210L, 1461490210L, Protocol.DeckSourceType.DECK_SOURCE_TYPE_BASIC_DECK.getNumber()));
|
||||||
|
deckContentRepository.save(new DeckContent(user.getId(), d.getId(), 670L, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateDeckName(Long userId, Long deckId, String name) {
|
||||||
|
deckRepository.updateDeckName(userId, deckId, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Deck> getDecksForUser(Long userId) {
|
||||||
|
return deckRepository.findDecksByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DeckContent> getDeckContentForDeckId(Long userId, Long deckId) {
|
||||||
|
return deckContentRepository.findCardsByDeckId(userId, deckId);
|
||||||
|
}
|
||||||
|
|
||||||
public User findByUsername(String username) {
|
public User findByUsername(String username) {
|
||||||
return userRepository.findByUsername(username);
|
return userRepository.findByUsername(username);
|
||||||
@ -54,6 +70,10 @@ public class UserService implements IService {
|
|||||||
return cardBackRepository.findByUserId(userId);
|
return cardBackRepository.findByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CardBack getCardBackById(Long id) {
|
||||||
|
return cardBackRepository.findById(id).orElse(new CardBack());
|
||||||
|
}
|
||||||
|
|
||||||
public void setDefaultUserCardBack(Long userId, Integer cardBack) {
|
public void setDefaultUserCardBack(Long userId, Integer cardBack) {
|
||||||
CardBack cb = cardBackRepository.findByUserIdAndBackId(userId, cardBack).get();
|
CardBack cb = cardBackRepository.findByUserIdAndBackId(userId, cardBack).get();
|
||||||
userRepository.updateCardBackOfUser(userId, cb.getId());
|
userRepository.updateCardBackOfUser(userId, cb.getId());
|
||||||
|
@ -2237,6 +2237,30 @@ message GetAdventureProgress {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ref: PegasusUtil.Achieve
|
||||||
|
message Achieve {
|
||||||
|
required int32 id = 1;
|
||||||
|
required int32 progress = 2;
|
||||||
|
required int32 ack_progress = 3;
|
||||||
|
optional int32 completion_count = 4;
|
||||||
|
optional bool active = 5;
|
||||||
|
optional int32 started_count = 6;
|
||||||
|
optional Date date_given = 7;
|
||||||
|
optional Date date_completed = 8;
|
||||||
|
optional bool do_not_ack = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ref: PegasusUtil.Achieves
|
||||||
|
message Achieves {
|
||||||
|
// ref: PegasusUtil.Achieves/PacketID
|
||||||
|
enum PacketID {
|
||||||
|
ID = 252;
|
||||||
|
}
|
||||||
|
|
||||||
|
repeated Achieve list = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ref: PegasusUtil.SetOptions
|
// ref: PegasusUtil.SetOptions
|
||||||
message SetOptions {
|
message SetOptions {
|
||||||
// ref: PegasusUtil.SetOptions/MaxOptionCount
|
// ref: PegasusUtil.SetOptions/MaxOptionCount
|
||||||
@ -3412,3 +3436,16 @@ message BoughtSoldCard {
|
|||||||
optional int32 unit_sell_price = 6;
|
optional int32 unit_sell_price = 6;
|
||||||
optional int32 unit_buy_price = 7;
|
optional int32 unit_buy_price = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ref: PegasusUtil.RenameDeck
|
||||||
|
message RenameDeck {
|
||||||
|
// ref: PegasusUtil.RenameDeck/PacketID
|
||||||
|
enum PacketID {
|
||||||
|
system = 0;
|
||||||
|
ID = 211;
|
||||||
|
}
|
||||||
|
|
||||||
|
required int64 deck = 1;
|
||||||
|
required string name = 2;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user