diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 8d81632..fe63bb6 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 5e708ca..cc41ec6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,9 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.9.22" + kotlin("jvm") version "1.9.23" application - id("io.ktor.plugin") version "2.3.8" + id("io.ktor.plugin") version "2.3.9" } group = "net.taehui" @@ -14,11 +14,11 @@ } dependencies { - implementation("com.fasterxml.jackson.core:jackson-annotations:2.16.1") - implementation("com.fasterxml.jackson.core:jackson-core:2.16.1") - implementation("com.fasterxml.jackson.core:jackson-databind:2.16.1") - implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1") - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.16.1") + implementation("com.fasterxml.jackson.core:jackson-annotations:2.17.0") + implementation("com.fasterxml.jackson.core:jackson-core:2.17.0") + implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0") + implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.0") + implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.0") implementation("com.github.pemistahl:lingua:1.2.2") implementation("com.google.protobuf:protobuf-java:3.25.3") implementation("com.google.protobuf:protobuf-kotlin:3.25.3") @@ -28,14 +28,14 @@ implementation("commons-codec:commons-codec:1.16.1") implementation("commons-io:commons-io:2.15.1") implementation("io.netty:netty-all:4.1.107.Final") - implementation("jakarta.mail:jakarta.mail-api:2.1.2") - implementation("net.dv8tion:JDA:5.0.0-beta.20") - implementation("org.apache.commons:commons-compress:1.26.0") - implementation("org.apache.commons:commons-dbcp2:2.11.0") + implementation("jakarta.mail:jakarta.mail-api:2.1.3") + implementation("net.dv8tion:JDA:5.0.0-beta.21") + implementation("org.apache.commons:commons-compress:1.26.1") + implementation("org.apache.commons:commons-dbcp2:2.12.0") implementation("org.apache.commons:commons-lang3:3.14.0") implementation("org.apache.httpcomponents.client5:httpclient5:5.3.1") - implementation("org.apache.logging.log4j:log4j-core:2.23.0") - implementation("org.apache.logging.log4j:log4j-slf4j2-impl:2.23.0") + implementation("org.apache.logging.log4j:log4j-core:2.23.1") + implementation("org.apache.logging.log4j:log4j-slf4j2-impl:2.23.1") implementation("org.jline:jline:3.25.1") implementation("org.jline:jline-terminal-jansi:3.25.1") implementation("org.jsoup:jsoup:1.17.2") diff --git a/src/main/java/EventOuterClass.java b/src/main/java/EventOuterClass.java index 98bea31..c4c57ce 100644 --- a/src/main/java/EventOuterClass.java +++ b/src/main/java/EventOuterClass.java @@ -845,6 +845,10 @@ * SET_ALLOWED_POSTABLE_ITEMS = 89; */ SET_ALLOWED_POSTABLE_ITEMS(89), + /** + * SET_POSTABLE_ITEM_BAND = 90; + */ + SET_POSTABLE_ITEM_BAND(90), UNRECOGNIZED(-1), ; @@ -1200,6 +1204,10 @@ * SET_ALLOWED_POSTABLE_ITEMS = 89; */ public static final int SET_ALLOWED_POSTABLE_ITEMS_VALUE = 89; + /** + * SET_POSTABLE_ITEM_BAND = 90; + */ + public static final int SET_POSTABLE_ITEM_BAND_VALUE = 90; public final int getNumber() { @@ -1314,6 +1322,7 @@ case 87: return POST_ITEM; case 88: return SET_VALID_NET_MODE; case 89: return SET_ALLOWED_POSTABLE_ITEMS; + case 90: return SET_POSTABLE_ITEM_BAND; default: return null; } } @@ -28318,7 +28327,7 @@ descriptor; static { java.lang.String[] descriptorData = { - "\n\013Event.proto\"\2141\n\005Event\022\016\n\006millis\030\001 \001(\003\022" + + "\n\013Event.proto\"\2501\n\005Event\022\016\n\006millis\030\001 \001(\003\022" + "\020\n\010avatarID\030\002 \001(\t\022\037\n\007eventID\030\003 \001(\0162\016.Eve" + "nt.EventID\022\014\n\004text\030\004 \001(\t\022\014\n\004data\030\005 \003(\014\0221" + "\n\017qwilightCallNet\030\006 \001(\0132\026.Event.Qwilight" + @@ -28432,7 +28441,7 @@ "ghtPostItem\022\021\n\thandlerID\030\001 \001(\t\022\022\n\nposted" + "Item\030\002 \001(\005\022\022\n\navatarName\030\003 \001(\t\022\014\n\004wait\030\004" + " \001(\001\"5\n\017AvatarNetStatus\022\013\n\007Default\020\000\022\t\n\005" + - "Clear\020\001\022\n\n\006Failed\020\002\"\252\r\n\007EventID\022\013\n\007SIGN_" + + "Clear\020\001\022\n\n\006Failed\020\002\"\306\r\n\007EventID\022\013\n\007SIGN_" + "IN\020\000\022\017\n\013NOT_SIGN_IN\020\001\022\013\n\007WARNING\020\002\022\r\n\tSI" + "TE_YELL\020\003\022\017\n\013CALL_BUNDLE\020\004\022\022\n\016SAVE_AS_BU" + "NDLE\020\005\022\021\n\rSAVING_BUNDLE\020\006\022\017\n\013WIPE_BUNDLE" + @@ -28475,7 +28484,8 @@ "SET_FAVOR\020T\022\026\n\022SET_AUTO_SITE_HAND\020U\022\024\n\020S" + "ET_AVATAR_GROUP\020V\022\r\n\tPOST_ITEM\020W\022\026\n\022SET_" + "VALID_NET_MODE\020X\022\036\n\032SET_ALLOWED_POSTABLE" + - "_ITEMS\020YB\n\n\010fastTextb\006proto3" + "_ITEMS\020Y\022\032\n\026SET_POSTABLE_ITEM_BAND\020ZB\n\n\010" + + "fastTextb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, diff --git a/src/main/kotlin/net/taehui/twilight/JSON.kt b/src/main/kotlin/net/taehui/twilight/JSON.kt index a88b138..d31b4ec 100644 --- a/src/main/kotlin/net/taehui/twilight/JSON.kt +++ b/src/main/kotlin/net/taehui/twilight/JSON.kt @@ -255,6 +255,7 @@ var inputMode = Component.InputMode.INPUT_MODE_5_1 var bundleEntryPath = "" var allowedPostableItems = emptyArray() + var postableItemBand = 0 } class QwilightSetModeComponent { @@ -277,6 +278,11 @@ var allowedPostableItems = emptyArray() } + class QwilightSetPostableItemBand { + var siteID = "" + var postableItemBand = 0 + } + class QwilightSetConfigure { var silentSiteCompetence = 0 var toNotifyUbuntuCompetence = 0 diff --git a/src/main/kotlin/net/taehui/twilight/Site.kt b/src/main/kotlin/net/taehui/twilight/Site.kt index afa2b73..3abff2f 100644 --- a/src/main/kotlin/net/taehui/twilight/Site.kt +++ b/src/main/kotlin/net/taehui/twilight/Site.kt @@ -83,6 +83,7 @@ private var siteSituation = SiteSituation.DEFAULT private var validHunterMode = 0 private var validNetMode = 0 + private var postableItemBand = 0 private var allowedPostableItems = emptyArray() private var noteID = "" private var noteIDs: Array? = null @@ -430,6 +431,7 @@ val validHunterMode = this@Site.validHunterMode val validNetMode = this@Site.validNetMode + val postableItemBand = this@Site.postableItemBand val allowedPostableItems = this@Site.allowedPostableItems val bundleEntryPath = this@Site.bundleEntryPath val bundleName = this@Site.bundleName @@ -446,7 +448,7 @@ fun setLevying(avatar: Avatar) { synchronized(avatarsCSX) { if (siteMode == SiteMode.NET && isAvatarJoined(avatar) && siteSituation == SiteSituation.DEFAULT) { - if (siteHand == avatar && validNetMode > 0 && allowedPostableItems.isEmpty()) { + if (siteHand == avatar && validNetMode == 1 && allowedPostableItems.isEmpty()) { send(EventOuterClass.Event.EventID.WARNING, avatar.translateLanguage("wrongAllowedPostableItems")) } else { val avatarID = avatar.avatarID @@ -493,6 +495,7 @@ val validHunterMode = this@Site.validHunterMode val validNetMode = this@Site.validNetMode + val postableItemBand = this@Site.postableItemBand val allowedPostableItems = this@Site.allowedPostableItems val modeComponentData = this@Site.modeComponentData @@ -780,6 +783,7 @@ val validHunterMode = this@Site.validHunterMode val validNetMode = this@Site.validNetMode + val postableItemBand = this@Site.postableItemBand val allowedPostableItems = this@Site.allowedPostableItems val bundleName = this@Site.bundleName val modeComponentData = this@Site.modeComponentData @@ -1311,6 +1315,22 @@ } } + fun setPostableItemBand(postableItemBand: Int) { + this.postableItemBand = postableItemBand + doCallSiteNet() + } + + fun setPostableItemBand( + avatar: Avatar, + qwilightSetPostableItemBand: JSON.QwilightSetPostableItemBand + ) { + synchronized(avatarsCSX) { + if (siteMode == SiteMode.NET && siteHand == avatar && siteSituation == SiteSituation.DEFAULT) { + setPostableItemBand(qwilightSetPostableItemBand.postableItemBand) + } + } + } + fun doCallNetSiteComments(avatar: Avatar) { synchronized(avatarsCSX) { if (siteMode == SiteMode.NET && isAvatarJoined(avatar)) { diff --git a/src/main/kotlin/net/taehui/twilight/qwilight/QwilightAvatar.kt b/src/main/kotlin/net/taehui/twilight/qwilight/QwilightAvatar.kt index 5e991e2..0dd083e 100644 --- a/src/main/kotlin/net/taehui/twilight/qwilight/QwilightAvatar.kt +++ b/src/main/kotlin/net/taehui/twilight/qwilight/QwilightAvatar.kt @@ -1087,6 +1087,15 @@ ) } + EventOuterClass.Event.EventID.SET_POSTABLE_ITEM_BAND -> wantEstablished { + val text = jm.readValue(eventText, JSON.QwilightSetPostableItemBand::class.java) + SiteHandler.setPostableItemBand( + this, + UUID.fromString(text.siteID), + text + ) + } + EventOuterClass.Event.EventID.CALL_NET_SITE_COMMENTS -> wantEstablished { SiteHandler.doCallNetSiteComments( this, diff --git a/src/main/kotlin/net/taehui/twilight/system/AvatarHandler.kt b/src/main/kotlin/net/taehui/twilight/system/AvatarHandler.kt index cd51ce6..78ef86b 100644 --- a/src/main/kotlin/net/taehui/twilight/system/AvatarHandler.kt +++ b/src/main/kotlin/net/taehui/twilight/system/AvatarHandler.kt @@ -7,14 +7,6 @@ object AvatarHandler { private val avatars = ConcurrentHashMap() - fun doNotify(text: String) { - avatars.values.forEach { avatar -> - Translator.translate(avatar.language, text, avatar).thenAccept { - avatar.send(EventOuterClass.Event.EventID.NOTIFY_INFO, it) - } - } - } - fun doInfo(logger: Logger) { avatars.values.filter { !it.isAwilight }.forEach { logger.logInfo(it.toString()) } } diff --git a/src/main/kotlin/net/taehui/twilight/system/DB.kt b/src/main/kotlin/net/taehui/twilight/system/DB.kt index 7d409cb..cf3bf88 100644 --- a/src/main/kotlin/net/taehui/twilight/system/DB.kt +++ b/src/main/kotlin/net/taehui/twilight/system/DB.kt @@ -3013,7 +3013,7 @@ handledAvatarHandledItemMap.getOrDefault(Component.Handled.ASSIST_CLEAR, emptyList()).size val noteIDCount = AbilitySystem.getNoteIDCount(levelName, levelID) val avatarHandledItems = handledAvatarHandledItemMap.map { - Pair(it.key, it.value.sortedByDescending { it.stand }.take(50)) + Pair(it.key, it.value.sortedByDescending { avatarHandledItem -> avatarHandledItem.stand }.take(50)) }.toMap() } } @@ -3141,12 +3141,12 @@ SELECT tw_note.Note_ID, Note_Variety, Artist, Title, Genre, Level_Text, tw_note.Level, Stand, Avatar_ID, Avatar_Name, Ability_5K * (POWER(Stand / 1000000, 3) - 0.5 * POWER(Stand / 1000000, 2) + 0.5 * (Stand / 1000000)) AS Value FROM tw_note, tw_comment, tn_avatar WHERE tw_note.Note_ID = tw_comment.Note_ID AND tw_comment.Avatar = tn_avatar.Avatar_ID AND Ability_5K > 0.0 AND ${ - getAbilityFilter( - Component.DEFAULT_INPUT_FAVOR_MODE, - Component.MODE_5_INPUT_FAVOR_MODE, - Component.MODE_5_1_INPUT_FAVOR_MODE - ) - } AND Is_Max = true + getAbilityFilter( + Component.DEFAULT_INPUT_FAVOR_MODE, + Component.MODE_5_INPUT_FAVOR_MODE, + Component.MODE_5_1_INPUT_FAVOR_MODE + ) + } AND Is_Max = true ORDER BY Value DESC """.trimIndent() ).use { dbStatement -> @@ -3180,12 +3180,12 @@ SELECT Ability_5K * (POWER(Stand / 1000000, 3) - 0.5 * POWER(Stand / 1000000, 2) + 0.5 * (Stand / 1000000)) AS Value FROM tw_note, tw_comment, tn_avatar WHERE tw_note.Note_ID = tw_comment.Note_ID AND tw_comment.Avatar = tn_avatar.Avatar_ID AND Avatar_ID = ? AND Ability_5K > 0.0 AND ${ - getAbilityFilter( - Component.DEFAULT_INPUT_FAVOR_MODE, - Component.MODE_5_INPUT_FAVOR_MODE, - Component.MODE_5_1_INPUT_FAVOR_MODE - ) - } AND Is_Max = true + getAbilityFilter( + Component.DEFAULT_INPUT_FAVOR_MODE, + Component.MODE_5_INPUT_FAVOR_MODE, + Component.MODE_5_1_INPUT_FAVOR_MODE + ) + } AND Is_Max = true ORDER BY Value DESC LIMIT 50 """.trimIndent() @@ -3210,12 +3210,12 @@ SELECT tw_note.Note_ID, Note_Variety, Artist, Title, Genre, Level_Text, tw_note.Level, Stand, Avatar_ID, Avatar_Name, Ability_7K * (POWER(Stand / 1000000, 3) - 0.5 * POWER(Stand / 1000000, 2) + 0.5 * (Stand / 1000000)) AS Value FROM tw_note, tw_comment, tn_avatar WHERE tw_note.Note_ID = tw_comment.Note_ID AND tw_comment.Avatar = tn_avatar.Avatar_ID AND Ability_7K > 0.0 AND ${ - getAbilityFilter( - Component.DEFAULT_INPUT_FAVOR_MODE, - Component.MODE_7_INPUT_FAVOR_MODE, - Component.MODE_7_1_INPUT_FAVOR_MODE - ) - } AND Is_Max = true + getAbilityFilter( + Component.DEFAULT_INPUT_FAVOR_MODE, + Component.MODE_7_INPUT_FAVOR_MODE, + Component.MODE_7_1_INPUT_FAVOR_MODE + ) + } AND Is_Max = true ORDER BY Value DESC """.trimIndent() ).use { dbStatement -> @@ -3249,12 +3249,12 @@ SELECT Ability_7K * (POWER(Stand / 1000000, 3) - 0.5 * POWER(Stand / 1000000, 2) + 0.5 * (Stand / 1000000)) AS Value FROM tw_note, tw_comment, tn_avatar WHERE tw_note.Note_ID = tw_comment.Note_ID AND tw_comment.Avatar = tn_avatar.Avatar_ID AND Avatar_ID = ? AND Ability_7K > 0.0 AND ${ - getAbilityFilter( - Component.DEFAULT_INPUT_FAVOR_MODE, - Component.MODE_7_INPUT_FAVOR_MODE, - Component.MODE_7_1_INPUT_FAVOR_MODE - ) - } AND Is_Max = true + getAbilityFilter( + Component.DEFAULT_INPUT_FAVOR_MODE, + Component.MODE_7_INPUT_FAVOR_MODE, + Component.MODE_7_1_INPUT_FAVOR_MODE + ) + } AND Is_Max = true ORDER BY Value DESC LIMIT 50 """.trimIndent() @@ -3279,11 +3279,11 @@ SELECT tw_note.Note_ID, Note_Variety, Artist, Title, Genre, Level_Text, tw_note.Level, Stand, Avatar_ID, Avatar_Name, Ability_9K * (POWER(Stand / 1000000, 3) - 0.5 * POWER(Stand / 1000000, 2) + 0.5 * (Stand / 1000000)) AS Value FROM tw_note, tw_comment, tn_avatar WHERE tw_note.Note_ID = tw_comment.Note_ID AND tw_comment.Avatar = tn_avatar.Avatar_ID AND Ability_9K > 0.0 AND ${ - getAbilityFilter( - Component.DEFAULT_INPUT_FAVOR_MODE, - Component.MODE_9_INPUT_FAVOR_MODE - ) - } AND Is_Max = true + getAbilityFilter( + Component.DEFAULT_INPUT_FAVOR_MODE, + Component.MODE_9_INPUT_FAVOR_MODE + ) + } AND Is_Max = true ORDER BY Value DESC """.trimIndent() ).use { dbStatement -> @@ -3317,11 +3317,11 @@ SELECT Ability_9K * (POWER(Stand / 1000000, 3) - 0.5 * POWER(Stand / 1000000, 2) + 0.5 * (Stand / 1000000)) AS Value FROM tw_note, tw_comment, tn_avatar WHERE tw_note.Note_ID = tw_comment.Note_ID AND tw_comment.Avatar = tn_avatar.Avatar_ID AND Avatar_ID = ? AND Ability_9K > 0.0 AND ${ - getAbilityFilter( - Component.DEFAULT_INPUT_FAVOR_MODE, - Component.MODE_9_INPUT_FAVOR_MODE - ) - } AND Is_Max = true + getAbilityFilter( + Component.DEFAULT_INPUT_FAVOR_MODE, + Component.MODE_9_INPUT_FAVOR_MODE + ) + } AND Is_Max = true ORDER BY Value DESC LIMIT 50 """.trimIndent() diff --git a/src/main/kotlin/net/taehui/twilight/system/IO.kt b/src/main/kotlin/net/taehui/twilight/system/IO.kt index d7acbdf..1563c21 100644 --- a/src/main/kotlin/net/taehui/twilight/system/IO.kt +++ b/src/main/kotlin/net/taehui/twilight/system/IO.kt @@ -85,20 +85,6 @@ when (w0) { "stop" -> stopText = w.elementAtOrNull(1) ?: "" - "alarm" -> { - if (w.size > 2) { - SiteHandler.setSiteNotify( - SiteHandler.getSiteID(w[1]), w[2] - ) - continue - } else if (w.size > 1) { - AvatarHandler.doNotify(w[1]) - continue - } - - logInfo("alarm ") - } - "avatar" -> { if (w.size > 1) { when (w[1]) { @@ -107,7 +93,7 @@ continue } - "quit" -> { + "exile" -> { if (w.size > 2) { AvatarHandler.handleNotSignIn(w[2]) continue @@ -142,10 +128,10 @@ } } } - logInfo("avatar view View Avatars") - logInfo("avatar quit Quit Avatar") - logInfo("avatar ban Ban Avatar IP") - logInfo("avatar allow Allow Avatar IP") + logInfo("avatar view: View Avatars") + logInfo("avatar exile : Exile Avatar") + logInfo("avatar ban : Ban Avatar IP") + logInfo("avatar allow : Allow Avatar IP") } "awilight" -> { @@ -165,7 +151,7 @@ } } - logInfo("awilight set Set Awilight") + logInfo("awilight set : Set Awilight") } "bundle" -> { @@ -183,7 +169,7 @@ } } - logInfo("bundle wipe Clean Bundle Files") + logInfo("bundle wipe: Clean Bundle Files") } "comment" -> { @@ -222,8 +208,8 @@ } } - logInfo("comment learn Learn Comments") - logInfo("comment wipe Clean Comment Files") + logInfo("comment learn : Learn Comments") + logInfo("comment wipe: Clean Comment Files") } "future" -> { @@ -285,7 +271,7 @@ } } - logInfo("handled learn Learn Handled") + logInfo("handled learn: Learn Handled") } "note" -> { @@ -383,11 +369,11 @@ } } - logInfo("note learn Learn Notes") - logInfo("note ban Ban Note") - logInfo("note allow Allow Note") - logInfo("note wipe Clean or Wipe Note File") - logInfo("note pms PMS Note File") + logInfo("note learn: Learn Notes") + logInfo("note ban : Ban Note") + logInfo("note allow : Allow Note") + logInfo("note wipe : Clean or Wipe Note File") + logInfo("note pms : PMS Note File") } "pause" -> { @@ -429,10 +415,10 @@ } } - logInfo("platform avatar Handle Avatar") - logInfo("platform view View Platform") - logInfo("platform dispose Close Platform") - logInfo("platform handle Handle Platform") + logInfo("platform avatar : Handle Avatar") + logInfo("platform view: View Platform") + logInfo("platform dispose: Close Platform") + logInfo("platform handle: Handle Platform") } "ram" -> { @@ -472,12 +458,22 @@ continue } } + + "alarm" -> { + if (w.size > 3) { + SiteHandler.setSiteNotify( + SiteHandler.getSiteID(w[2]), w[3] + ) + continue + } + } } } - logInfo("site view View Sites") - logInfo("site put Put Site") - logInfo("site wipe Wipe Site") - logInfo("site silent Silent Site") + logInfo("site view: View Sites") + logInfo("site put : Put Site") + logInfo("site wipe : Wipe Site") + logInfo("site silent: Silent Site") + logInfo("site alarm : Send Notify") } "tv" -> { @@ -499,24 +495,23 @@ } } } - logInfo("tv view View TV") - logInfo("tv dispose Close TV") - logInfo("tv handle Handle TV") + logInfo("tv view: View TV") + logInfo("tv dispose: Close TV") + logInfo("tv handle: Handle TV") } else -> { - logInfo("[alarm Send Notify") - logInfo("[avatar Handle Avatars") - logInfo("[awilight Handle Awilight") - logInfo("[bundle Handle Bundles") - logInfo("[comment Handle Comments") - logInfo("[future View Futures") - logInfo("[note Handle Notes") - logInfo("[pause Pause Twilight") - logInfo("[platform Handle Platform") - logInfo("[site Handle Sites") - logInfo("[tv Handle TV") - logInfo("[stop Stop Twilight") + logInfo("[avatar: Handle Avatars") + logInfo("[awilight: Handle Awilights") + logInfo("[bundle: Handle Bundles") + logInfo("[comment: Handle Comments") + logInfo("[future: View Futures") + logInfo("[note: Handle Notes") + logInfo("[pause: Pause Twilight") + logInfo("[platform: Handle Platform") + logInfo("[site: Handle Sites") + logInfo("[tv: Handle TV") + logInfo("[stop: Stop Twilight") } } } diff --git a/src/main/kotlin/net/taehui/twilight/system/PlatformIDSystem.kt b/src/main/kotlin/net/taehui/twilight/system/PlatformIDSystem.kt index 081b4f7..fd81cf9 100644 --- a/src/main/kotlin/net/taehui/twilight/system/PlatformIDSystem.kt +++ b/src/main/kotlin/net/taehui/twilight/system/PlatformIDSystem.kt @@ -28,11 +28,11 @@ } fun putPlatformID(platformID: String, avatarID: String) { - platformIDAvatarIDMap[if (platformID.startsWith("$")) platformID else "$${platformID}"] = avatarID + platformIDAvatarIDMap[if (platformID.startsWith("$")) platformID else "$$platformID"] = avatarID } fun wipePlatformID(platformID: String) { - platformIDAvatarIDMap.remove(if (platformID.startsWith("$")) platformID else "$${platformID}") + platformIDAvatarIDMap.remove(if (platformID.startsWith("$")) platformID else "$$platformID") } fun getAvatarID(platformID: String): String { diff --git a/src/main/kotlin/net/taehui/twilight/system/PlatformSystem.kt b/src/main/kotlin/net/taehui/twilight/system/PlatformSystem.kt index 63658e3..7e4af26 100644 --- a/src/main/kotlin/net/taehui/twilight/system/PlatformSystem.kt +++ b/src/main/kotlin/net/taehui/twilight/system/PlatformSystem.kt @@ -6,6 +6,7 @@ import net.dv8tion.jda.api.JDABuilder import net.dv8tion.jda.api.entities.Guild import net.dv8tion.jda.api.entities.Member +import net.dv8tion.jda.api.entities.UserSnowflake import net.dv8tion.jda.api.entities.channel.concrete.TextChannel import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent import net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent @@ -265,4 +266,10 @@ fun getDrawing(avatarID: String): ByteArray? { return drawingStore[avatarID] } + + fun putAbility(platformID: String, abilityName: String) { + qwilightPlatform?.getRolesByName(abilityName, true)?.forEach { + qwilightPlatform?.addRoleToMember(UserSnowflake.fromId(platformID), it) + } + } } \ No newline at end of file diff --git a/src/main/kotlin/net/taehui/twilight/system/SiteHandler.kt b/src/main/kotlin/net/taehui/twilight/system/SiteHandler.kt index 0c541aa..0d0c861 100644 --- a/src/main/kotlin/net/taehui/twilight/system/SiteHandler.kt +++ b/src/main/kotlin/net/taehui/twilight/system/SiteHandler.kt @@ -183,6 +183,16 @@ ) } + fun setPostableItemBand( + avatar: Avatar, + siteID: UUID, + qwilightSetPostableItemBand: JSON.QwilightSetPostableItemBand + ) { + sites[siteID]?.setPostableItemBand( + avatar, qwilightSetPostableItemBand + ) + } + fun doCallNetSiteComments(avatar: Avatar, siteID: UUID) { sites[siteID]?.doCallNetSiteComments( avatar @@ -299,6 +309,7 @@ bundleEntryPath = qwilightNewSite.bundleEntryPath }) site.setAllowedPostableItems(qwilightNewSite.allowedPostableItems) + site.setPostableItemBand(qwilightNewSite.postableItemBand) site.enterSite(avatar) }