From 48ae7871652038560a302cd6aa56a5980c400f8e Mon Sep 17 00:00:00 2001 From: devxb Date: Sat, 16 Nov 2024 21:21:19 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20hamster=20js=F0=9F=90=B9=20=ED=8E=AB?= =?UTF-8?q?=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README-en.md | 1 + README-zhcn.md | 1 + README.md | 1 + docs/hamster-js.svg | 120 +++++++++++++ .../gitanimals/render/domain/PersonaType.kt | 15 ++ .../org/gitanimals/render/domain/Svgs.kt | 3 + .../resources/persona/animal/hamster-js.svg | 166 ++++++++++++++++++ 7 files changed, 307 insertions(+) create mode 100644 docs/hamster-js.svg create mode 100644 src/main/resources/persona/animal/hamster-js.svg diff --git a/README-en.md b/README-en.md index d376d36..611b196 100644 --- a/README-en.md +++ b/README-en.md @@ -121,6 +121,7 @@ _New contributions may take up to 1 hour to be reflected._ | name | ratio | Description | |---------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| HAMSTER_JS
| 0.01 | | | HAMSTER_KOTLIN
| 0.01 | | | HAMSTER_JAVA
| 0.01 | | | HAMSTER_SPRING
| 0.01 | | diff --git a/README-zhcn.md b/README-zhcn.md index 9d637c4..4d9b61e 100644 --- a/README-zhcn.md +++ b/README-zhcn.md @@ -120,6 +120,7 @@ _新的贡献可能需要1个小时才能显示_ | 名字 | 概率 | 描述 | |---------------------------------------------------------------------------------------------------------|-------|--------------------------------------------------------------------------------------------------------------------| +| HAMSTER_JS
| 0.01 | | | HAMSTER_KOTLIN
| 0.01 | | | HAMSTER_JAVA
| 0.01 | | | HAMSTER_SPRING
| 0.01 | | diff --git a/README.md b/README.md index b5adce3..29147b3 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ _새로운 contribution 반영은 최대 1시간이 소요될 수 있어요._ | name | ratio | Description | |----------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| HAMSTER_JS
| 0.01 | | | HAMSTER_KOTLIN
| 0.01 | | | HAMSTER_JAVA
| 0.01 | | | HAMSTER_SPRING
| 0.01 | | diff --git a/docs/hamster-js.svg b/docs/hamster-js.svg new file mode 100644 index 0000000..a53574a --- /dev/null +++ b/docs/hamster-js.svg @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index 34f282c..4889bde 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1406,6 +1406,21 @@ enum class PersonaType(val weight: Double, private var dropRate: String? = null) StringBuilder().moveRandomly("hamster", id, 5, "1000s", 5, 21.0) .toString() }, + HAMSTER_JS(0.01) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + return hamsterJsSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-5 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("hamster", id, 5, "1000s", 5, 21.0) + .toString() + }, ; init { diff --git a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt index 0c10293..4e04d07 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -265,6 +265,9 @@ val hamsterJavaSvg: String = ClassPathResource("persona/animal/hamster-java.svg" val hamsterKotlinSvg: String = ClassPathResource("persona/animal/hamster-kotlin.svg") .getContentAsString(Charset.defaultCharset()) +val hamsterJsSvg: String = ClassPathResource("persona/animal/hamster-js.svg") + .getContentAsString(Charset.defaultCharset()) + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/persona/animal/hamster-js.svg b/src/main/resources/persona/animal/hamster-js.svg new file mode 100644 index 0000000..2677b3d --- /dev/null +++ b/src/main/resources/persona/animal/hamster-js.svg @@ -0,0 +1,166 @@ + + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +