diff --git a/ENGLISH.md b/README-en.md similarity index 91% rename from ENGLISH.md rename to README-en.md index 3a7437e..c884e25 100644 --- a/ENGLISH.md +++ b/README-en.md @@ -3,7 +3,9 @@ ##
- 한국어로 번역하기 + +**English** | [한국어](README.md) | [简体中文](README-zhcn.md) +

@@ -119,11 +121,17 @@ _New contributions may take up to 1 hour to be reflected._ | name | ratio | Description | |---------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| SCREAM_GHOST
| 0.001 | 😱2024 Halloween pet😱 | +| SCREAM
| 0.005 | 😱2024 Halloween pet😱 | +| GHOST_KING
| 0.01 | 👻2024 Halloween pet👻 | +| GHOST
| 0.05 | 👻2024 Halloween pet👻 | +| SLIME_PUMPKIN_1
| 0.08 | 🎃2024 Halloween pet🎃 | +| SLIME_PUMPKIN_2
| 0.08 | 🎃2024 Halloween pet🎃 | | TURTLE
| 0.03 | Designed by [@JIWOO CHOI](https://www.behance.net/sopungcjw42af) | -| SLOTH_SUNGLASSES
| 0.06 | | -| SLOTH_KING
| 0.05 | | -| SLOTH
| 0.7 | | -| DESSERT_FOX
| 0.05 | | +| SLOTH_SUNGLASSES
| 0.06 | | +| SLOTH_KING
| 0.05 | | +| SLOTH
| 0.7 | | +| DESSERT_FOX
| 0.05 | | | RABBIT
| 0.9 | | | MOLE
| 0.3 | | | MOLE_GRASS
| 0.1 | | @@ -190,7 +198,7 @@ _New contributions may take up to 1 hour to be reflected._ | dessert_fox_collaborator
| 0.0 | Pet made for collaborator [sumi-001](https://github.com/sumi-0011) | | white_cat_collaborator
| 0.0 | Pet made for collaborator [Ha youna](https://www.behance.net/hyn991022a6be) | | pig_collaborator
| 0.0 | Pet made for collaborator [hyesungoh](https://github.com/hyesungoh) | -| rabbit_collaborator
| 0.0 | Pet made for collaborator [Choi jiwoo](https://www.behance.net/sopungcjw42af) | +| rabbit_collaborator
| 0.0 | Pet made for collaborator [Choi jiwoo](https://www.behance.net/sopungcjw42af) | ## diff --git a/README-zhcn.md b/README-zhcn.md new file mode 100644 index 0000000..b1b533d --- /dev/null +++ b/README-zhcn.md @@ -0,0 +1,208 @@ + + +## + +
+ +[English](README-en.md) | [한국어](README.md) | **简体中文** + +
+
+ +
+ + + + +⭐️ 请点一下Star,这对我很重要!⭐️
+

Star

+
+ +
+

通过 GitHub 活动培养你的宠物!

+

您可以通过 GitHub 活动获取和饲养宠物。 +
当你提交30次 commits 时,你可以收养一只额外的宠物。 +
每次贡献都会使随机宠物的等级增加1。 +
你可以和其他人交换宠物。 +
+
+选择50多种不同的宠物并饲养它们! +
+ +你可以在[主页](https://gitanimals.org)购买并管理宠物。 + +

+
+ + docs/sample.svg + +
+ +## 开始 + +您可以将以下链接复制到自己的README。 + +> [!IMPORTANT] +> 请将 {username} 替换为您的用户名(如devxb)。 +> +> {username} 必须是您的用户名。 + +### 行模式 + +行模式允许您指定一只宠物在设置好的宽度和高度内移动。 + +使用行模式时,请改用HTML,因为markdown无法设置宽度和高度。 + +> [!TIP] +> **调整img的宽度和高度,以调整宠物的移动区域。** +> +> 如果将宽度设置长于高度(如宽度=1000,高度=60),宠物将在水平方向上移动非常长的距离。 +> +> 相反地,如果你让宽度变短,高度变长(宽度=60,高度=1000),宠物将垂直移动很长一段距离。 +> +> 如果宠物不可见,请增大img的高度。 + + + + + +```html + + + +``` + +如果您没有为宠物id输入任何值,则将自动设置为第一只宠物。 + +您可以在 `https://render.gitanimals.org/users/{username}` +中查看可用的宠物ID,将其添加到您的GitHub用户名并请求API。输入与 `$.epersonas.[].id` 对应的值。 + +在行模式下,贡献总数显示在宠物等级上。如果您不希望这样,请在API中加上`contribution-view=false`。 + +### 农场模式 + +农场模式显示您的所有宠物和信息。 + + + + + +```html + + + +``` + +## 提示 + +### 如何获取宠物 + +宠物可通过以下两种方式获取: + +1. **commits 30次** + +当你累积30次 commits 时,一个新的宠物将会出现。不过,所有宠物出现的概率都不同。 + +最多可以养30只宠物。如果你有更多宠物,超过30只的部分会进入你的库存,你可以随时将它们设置为展示状态。 + +2. **购买** + +你可以用 credits 购买其他用户出售的宠物。 + +每次 commits 都会得到一定的分数。或者,您可以将自己的宠物出售获得credits。 + +### 总贡献 + +贡献总数代表加入 GitHub 后累积的贡献总和。 + +_新的贡献可能需要1个小时才能显示_ + +### 可用宠物 + +| 名字 | 概率 | 描述 | +|---------------------------------------------------------------------------------------------------------|-------|--------------------------------------------------------------------------------------------------------------------| +| SCREAM_GHOST
| 0.001 | 😱2024 Halloween pet😱 | +| SCREAM
| 0.005 | 😱2024 Halloween pet😱 | +| GHOST_KING
| 0.01 | 👻2024 Halloween pet👻 | +| GHOST
| 0.05 | 👻2024 Halloween pet👻 | +| SLIME_PUMPKIN_1
| 0.08 | 🎃2024 Halloween pet🎃 | +| SLIME_PUMPKIN_2
| 0.08 | 🎃2024 Halloween pet🎃 | +| TURTLE
| 0.03 | 由 [@JIWOO CHOI](https://www.behance.net/sopungcjw42af) 设计 | +| SLOTH_SUNGLASSES
| 0.06 | | +| SLOTH_KING
| 0.05 | | +| SLOTH
| 0.7 | | +| DESSERT_FOX
| 0.05 | | +| RABBIT
| 0.9 | | +| MOLE
| 0.3 | | +| MOLE_GRASS
| 0.1 | | +| QUOKKA
| 0.3 | | +| QUOKKA_LEAF
| 0.1 | | +| QUOKKA_SUNGLASSES
| 0.05 | | +| FISH_MAN
| 0.001 | | +| FISH_MAN_GLASSES
| 0.001 | | +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | [10MM](https://github.com/depromeet/10mm-client-web) 捐款创建的角色
只能从商店购买 | +| goblin
| 0.06 | | +| goblin-bag
| 0.03 | | +| bibbi
| 0.00 | [BIBBI](https://play.google.com/store/apps/details?id=com.no5ing.bbibbi&hl=es_PY&gl=US&pli=1) 捐款创建的角色
只能从商店购买 | +| cat
| 0.1 | | +| cheese-cat
| 0.04 | | +| galchi-cat
| 0.06 | | +| white-cat
| 0.04 | | +| goose
| 1.0 | | +| goose_sunglasses
| 0.05 | | +| goose_kotlin
| 0.01 | | +| goose_java
| 0.01 | | +| goose_js
| 0.01 | | +| goose_node
| 0.01 | | +| goose_swift
| 0.01 | | +| goose_linux
| 0.01 | | +| goose_spring
| 0.01 | | +| little_chick
| 0.9 | | +| little_chick_suglasses
| 0.4 | | +| little_chick_kotlin
| 0.01 | | +| little_chick_java
| 0.01 | | +| little_chick_js
| 0.01 | | +| little_chick_node
| 0.01 | | +| little_chick_swift
| 0.01 | | +| little_chick_linux
| 0.01 | | +| little_chick_spring
| 0.01 | | +| penguin
| 0.5 | | +| penguin_sunglasses
| 0.2 | | +| penguin_kotlin
| 0.01 | | +| penguin_java
| 0.01 | | +| penguin_js
| 0.01 | | +| penguin_node
| 0.01 | | +| penguin_swift
| 0.01 | | +| penguin_linux
| 0.01 | | +| penguin_spring
| 0.01 | | +| pig
| 0.2 | | +| pig_sunglasses
| 0.08 | | +| pig_kotlin
| 0.01 | | +| pig_java
| 0.01 | | +| pig_js
| 0.01 | | +| pig_node
| 0.01 | | +| pig_swift
| 0.01 | | +| pig_linux
| 0.01 | | +| pig_spring
| 0.01 | | +| slime_red
| 0.1 | | +| slime_red_kotlin
| 0.001 | | +| slime_red_java
| 0.001 | | +| slime_red_js
| 0.001 | | +| slime_red_node
| 0.001 | | +| slime_red_swift
| 0.001 | | +| slime_red_linux
| 0.001 | | +| slime_green
| 0.1 | | +| slime_blue
| 0.1 | | +| cheese_cat_collaborator
| 0.0 | 协作者 [devxb](https://github.com/devxb) 制作 | +| dessert_fox_collaborator
| 0.0 | 协作者 [sumi-001](https://github.com/sumi-0011) 制作 | +| white_cat_collaborator
| 0.0 | 协作者 [Ha youna](https://www.behance.net/hyn991022a6be) 制作 | +| pig_collaborator
| 0.0 | 协作者 [hyesungoh](https://github.com/hyesungoh) 制作 | +| rabbit_collaborator
| 0.0 | 协作者 [Choi jiwoo](https://www.behance.net/sopungcjw42af) 制作 | + +## + +
+

如果你发现了bug,或者有任何想法,欢迎联系我们!
+联系方式: develxb@gmail.com

+ diff --git a/README.md b/README.md index 943af8c..a6f336c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,9 @@ ##
- Translate to english + +[English](README-en.md) | **한국어** | [简体中文](README-zhcn.md) +

@@ -112,80 +114,86 @@ _새로운 contribution 반영은 최대 1시간이 소요될 수 있어요._ ### 등장 가능한 펫들 -| name | ratio | Description | -|---------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| TURTLE
| 0.03 | Designed by [@JIWOO CHOI](https://www.behance.net/sopungcjw42af) | -| SLOTH_SUNGLASSES
| 0.06 | | -| SLOTH_KING
| 0.05 | | -| SLOTH
| 0.7 | | -| DESSERT_FOX
| 0.05 | | -| RABBIT
| 0.9 | | -| MOLE
| 0.3 | | -| MOLE_GRASS
| 0.1 | | -| QUOKKA
| 0.3 | | -| QUOKKA_LEAF
| 0.1 | | -| QUOKKA_SUNGLASSES
| 0.05 | | -| FISH_MAN
| 0.001 | | -| FISH_MAN_GLASSES
| 0.001 | | -| flamingo
| 0.08 | | -| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | -| goblin
| 0.06 | | -| goblin-bag
| 0.03 | | -| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | -| cat
| 0.1 | | -| cheese-cat
| 0.04 | | -| galchi-cat
| 0.06 | | -| white-cat
| 0.04 | | -| goose
| 1.0 | | -| goose_sunglasses
| 0.05 | | -| goose_kotlin
| 0.01 | | -| goose_java
| 0.01 | | -| goose_js
| 0.01 | | -| goose_node
| 0.01 | | -| goose_swift
| 0.01 | | -| goose_linux
| 0.01 | | -| goose_spring
| 0.01 | | -| little_chick
| 0.9 | | +| name | ratio | Description | +|----------------------------------------------------------------------------------------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| SCREAM_GHOST
| 0.001 | 😱2024 Halloween pet😱 | +| SCREAM
| 0.005 | 😱2024 Halloween pet😱 | +| GHOST_KING
| 0.01 | 👻2024 Halloween pet👻 | +| GHOST
| 0.05 | 👻2024 Halloween pet👻 | +| SLIME_PUMPKIN_1
| 0.08 | 🎃2024 Halloween pet🎃 | +| SLIME_PUMPKIN_2
| 0.08 | 🎃2024 Halloween pet🎃 | +| TURTLE
| 0.03 | Designed by [@JIWOO CHOI](https://www.behance.net/sopungcjw42af) | +| SLOTH_SUNGLASSES
| 0.06 | | +| SLOTH_KING
| 0.05 | | +| SLOTH
| 0.7 | | +| DESSERT_FOX
| 0.05 | | +| RABBIT
| 0.9 | | +| MOLE
| 0.3 | | +| MOLE_GRASS
| 0.1 | | +| QUOKKA
| 0.3 | | +| QUOKKA_LEAF
| 0.1 | | +| QUOKKA_SUNGLASSES
| 0.05 | | +| FISH_MAN
| 0.001 | | +| FISH_MAN_GLASSES
| 0.001 | | +| flamingo
| 0.08 | | +| TEN_MM
| 0.00 | Character created by `10MM` donations
Only buy in shop
10MM | +| goblin
| 0.06 | | +| goblin-bag
| 0.03 | | +| bibbi
| 0.00 | Character created by `BIBBI` donations
Only buy in shop
BIBBI | +| cat
| 0.1 | | +| cheese-cat
| 0.04 | | +| galchi-cat
| 0.06 | | +| white-cat
| 0.04 | | +| goose
| 1.0 | | +| goose_sunglasses
| 0.05 | | +| goose_kotlin
| 0.01 | | +| goose_java
| 0.01 | | +| goose_js
| 0.01 | | +| goose_node
| 0.01 | | +| goose_swift
| 0.01 | | +| goose_linux
| 0.01 | | +| goose_spring
| 0.01 | | +| little_chick
| 0.9 | | | little_chick_sunfsuglasses
| 0.4 | | -| little_chick_kotlin
| 0.01 | | -| little_chick_java
| 0.01 | | -| little_chick_js
| 0.01 | | -| little_chick_node
| 0.01 | | -| little_chick_swift
| 0.01 | | -| little_chick_linux
| 0.01 | | -| little_chick_spring
| 0.01 | | -| penguin
| 0.5 | | -| penguin_sunglasses
| 0.2 | | -| penguin_kotlin
| 0.01 | | -| penguin_java
| 0.01 | | -| penguin_js
| 0.01 | | -| penguin_node
| 0.01 | | -| penguin_swift
| 0.01 | | -| penguin_linux
| 0.01 | | -| penguin_spring
| 0.01 | | -| pig
| 0.2 | | -| pig_sunglasses
| 0.08 | | -| pig_kotlin
| 0.01 | | -| pig_java
| 0.01 | | -| pig_js
| 0.01 | | -| pig_node
| 0.01 | | -| pig_swift
| 0.01 | | -| pig_linux
| 0.01 | | -| pig_spring
| 0.01 | | -| slime_red
| 0.1 | | -| slime_red_kotlin
| 0.001 | | -| slime_red_java
| 0.001 | | -| slime_red_js
| 0.001 | | -| slime_red_node
| 0.001 | | -| slime_red_swift
| 0.001 | | -| slime_red_linux
| 0.001 | | -| slime_green
| 0.1 | | -| slime_blue
| 0.1 | | -| cheese_cat_collaborator
| 0.0 | Pet made for collaborator [devxb](https://github.com/devxb) | -| dessert_fox_collaborator
| 0.0 | Pet made for collaborator [sumi-001](https://github.com/sumi-0011) | -| white_cat_collaborator
| 0.0 | Pet made for collaborator [Ha youna](https://www.behance.net/hyn991022a6be) | -| pig_collaborator
| 0.0 | Pet made for collaborator [hyesungoh](https://github.com/hyesungoh) | -| rabbit_collaborator
| 0.0 | Pet made for collaborator [Choi jiwoo](https://www.behance.net/sopungcjw42af) | +| little_chick_kotlin
| 0.01 | | +| little_chick_java
| 0.01 | | +| little_chick_js
| 0.01 | | +| little_chick_node
| 0.01 | | +| little_chick_swift
| 0.01 | | +| little_chick_linux
| 0.01 | | +| little_chick_spring
| 0.01 | | +| penguin
| 0.5 | | +| penguin_sunglasses
| 0.2 | | +| penguin_kotlin
| 0.01 | | +| penguin_java
| 0.01 | | +| penguin_js
| 0.01 | | +| penguin_node
| 0.01 | | +| penguin_swift
| 0.01 | | +| penguin_linux
| 0.01 | | +| penguin_spring
| 0.01 | | +| pig
| 0.2 | | +| pig_sunglasses
| 0.08 | | +| pig_kotlin
| 0.01 | | +| pig_java
| 0.01 | | +| pig_js
| 0.01 | | +| pig_node
| 0.01 | | +| pig_swift
| 0.01 | | +| pig_linux
| 0.01 | | +| pig_spring
| 0.01 | | +| slime_red
| 0.1 | | +| slime_red_kotlin
| 0.001 | | +| slime_red_java
| 0.001 | | +| slime_red_js
| 0.001 | | +| slime_red_node
| 0.001 | | +| slime_red_swift
| 0.001 | | +| slime_red_linux
| 0.001 | | +| slime_green
| 0.1 | | +| slime_blue
| 0.1 | | +| cheese_cat_collaborator
| 0.0 | Pet made for collaborator [devxb](https://github.com/devxb) | +| dessert_fox_collaborator
| 0.0 | Pet made for collaborator [sumi-001](https://github.com/sumi-0011) | +| white_cat_collaborator
| 0.0 | Pet made for collaborator [Ha youna](https://www.behance.net/hyn991022a6be) | +| pig_collaborator
| 0.0 | Pet made for collaborator [hyesungoh](https://github.com/hyesungoh) | +| rabbit_collaborator
| 0.0 | Pet made for collaborator [Choi jiwoo](https://www.behance.net/sopungcjw42af) | ## diff --git a/docs/ghost-king.svg b/docs/ghost-king.svg new file mode 100644 index 0000000..c473b36 --- /dev/null +++ b/docs/ghost-king.svg @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/ghost.svg b/docs/ghost.svg new file mode 100644 index 0000000..e59da88 --- /dev/null +++ b/docs/ghost.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/scream-ghost.svg b/docs/scream-ghost.svg new file mode 100644 index 0000000..cb2927f --- /dev/null +++ b/docs/scream-ghost.svg @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/scream.svg b/docs/scream.svg new file mode 100644 index 0000000..3fb1653 --- /dev/null +++ b/docs/scream.svg @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/slime-pumpkin-1.svg b/docs/slime-pumpkin-1.svg new file mode 100644 index 0000000..a7288cd --- /dev/null +++ b/docs/slime-pumpkin-1.svg @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/slime-pumpkin-2.svg b/docs/slime-pumpkin-2.svg new file mode 100644 index 0000000..7d04391 --- /dev/null +++ b/docs/slime-pumpkin-2.svg @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt b/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt index 34ea133..2136b54 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/FieldType.kt @@ -39,6 +39,118 @@ enum class FieldType { return "" } }, + CARROT_AND_COIN { + override fun loadComponent(name: String, commit: Long): String { + return carrotAndCoinSvg.replace(NAME_FIX, name.toSvg(0.0, 3.0)) + .replace(COMMIT_FIX, commit.toSvg("commit", 260.0, 4.0)) + } + + override fun fillBackground(): String { + return """ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + """.trimIndent() + } + + override fun drawBorder(): String { + return "" + } + }, ; abstract fun loadComponent(name: String, commit: Long): String diff --git a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt index f776959..40df748 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/PersonaType.kt @@ -1,6 +1,5 @@ package org.gitanimals.render.domain -import java.math.RoundingMode import java.text.DecimalFormat import kotlin.math.atan2 import kotlin.math.max @@ -1234,7 +1233,7 @@ enum class PersonaType(val weight: Double, private var dropRate: String? = null) .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) .replace( "*{levelx}", - (-6 + (-1 * (persona.level.value.toString().length))).toString() + (-5 + (-1 * (persona.level.value.toString().length))).toString() ) } @@ -1257,6 +1256,96 @@ enum class PersonaType(val weight: Double, private var dropRate: String? = null) StringBuilder().moveRandomly("turtle", id, 5, "180s", 5, 33.5) .toString() }, + GHOST(0.05) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + return ghostSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-1.8 * (persona.level.value.toString().length)).toString() + ) + } + + override fun act(id: Long): String = StringBuilder() + .moveRandomly("ghost", id, 20, "180s", 7, 26.0) + .toString() + }, + GHOST_KING(0.01) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + return ghostKingSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-1.8 * (persona.level.value.toString().length)).toString() + ) + } + + override fun act(id: Long): String = StringBuilder() + .moveRandomly("ghost", id, 20, "180s", 7, 26.0) + .toString() + }, + SCREAM(0.005) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + return screamSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-6 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("scream", id, 10, "180s", 5, 17.5) + .toString() + }, + SCREAM_GHOST(0.001) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + return screamGhostSvg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-6 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("scream", id, 10, "180s", 5, 17.5) + .toString() + }, + SLIME_PUMPKIN_1(0.08) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + return slimePumpkin1Svg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-6 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("slime", id, 15, "180s", 5, 21.0) + .toString() + }, + SLIME_PUMPKIN_2(0.08) { + override fun loadSvg(user: User, persona: Persona, mode: Mode): String { + return slimePumpkin2Svg.replace("*{act}", act(persona.id)) + .replace("*{id}", persona.id.toString()) + .replace("*{level}", persona.level.value.toSvg(14.0, 2.0)) + .replace( + "*{levelx}", + (-6 + (-1 * (persona.level.value.toString().length))).toString() + ) + } + + override fun act(id: Long): String = + StringBuilder().moveRandomly("slime", id, 15, "180s", 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 f1bab0b..8d44e9c 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/Svgs.kt @@ -9,6 +9,9 @@ val whiteFieldSvg: String = ClassPathResource("persona/field/white-field.svg") val snowyFieldSvg: String = ClassPathResource("persona/field/snowy-field.svg") .getContentAsString(Charset.defaultCharset()) +val carrotAndCoinSvg: String = ClassPathResource("persona/field/carrot-and-coin.svg") + .getContentAsString(Charset.defaultCharset()) + val gooseSvg: String = ClassPathResource("persona/animal/goose.svg") .getContentAsString(Charset.defaultCharset()) @@ -226,6 +229,24 @@ val rabbitCollaboratorSvg: String = ClassPathResource("persona/animal/rabbit-col val turtleSvg: String = ClassPathResource("persona/animal/turtle.svg") .getContentAsString(Charset.defaultCharset()) +val ghostSvg: String = ClassPathResource("persona/animal/ghost.svg") + .getContentAsString(Charset.defaultCharset()) + +val ghostKingSvg: String = ClassPathResource("persona/animal/ghost-king.svg") + .getContentAsString(Charset.defaultCharset()) + +val screamSvg: String = ClassPathResource("persona/animal/scream.svg") + .getContentAsString(Charset.defaultCharset()) + +val screamGhostSvg: String = ClassPathResource("persona/animal/scream-ghost.svg") + .getContentAsString(Charset.defaultCharset()) + +val slimePumpkin1Svg: String = ClassPathResource("persona/animal/slime-pumpkin-1.svg") + .getContentAsString(Charset.defaultCharset()) + +val slimePumpkin2Svg: String = ClassPathResource("persona/animal/slime-pumpkin-2.svg") + .getContentAsString(Charset.defaultCharset()) + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt index 5b69185..444f3a9 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt @@ -53,7 +53,7 @@ class UserService( @Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 100) @Transactional - fun giveBonusPersona(name: String, persona: String) { + fun givePersonaByCoupon(name: String, persona: String) { requireIdempotency("$name:bonus") val user = getUserByName(name) diff --git a/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt b/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt index 3f3e407..c62027e 100644 --- a/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt +++ b/src/main/kotlin/org/gitanimals/render/saga/UsedCouponSagaHandlers.kt @@ -14,11 +14,15 @@ class UsedCouponSagaHandlers( @SagaCommitListener(event = CouponUsed::class) fun handleCouponUsedCommitEvent(sagaCommitEvent: SagaCommitEvent) { val couponUsed = sagaCommitEvent.decodeEvent(CouponUsed::class) - if (couponUsed.code != "NEW_USER_BONUS_PET") { + if ((couponUsed.code in acceptableCouponCodes).not()) { return } sagaCommitEvent.setNextEvent(couponUsed) - userService.giveBonusPersona(couponUsed.username, couponUsed.dynamic) + userService.givePersonaByCoupon(couponUsed.username, couponUsed.dynamic) + } + + private companion object { + private val acceptableCouponCodes = listOf("NEW_USER_BONUS_PET", "HALLOWEEN_2024", "HALLOWEEN_2024_STAR_BONUS") } } diff --git a/src/main/resources/persona/animal/ghost-king.svg b/src/main/resources/persona/animal/ghost-king.svg new file mode 100644 index 0000000..9b14009 --- /dev/null +++ b/src/main/resources/persona/animal/ghost-king.svg @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/ghost.svg b/src/main/resources/persona/animal/ghost.svg new file mode 100644 index 0000000..0e5dbfa --- /dev/null +++ b/src/main/resources/persona/animal/ghost.svg @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/scream-ghost.svg b/src/main/resources/persona/animal/scream-ghost.svg new file mode 100644 index 0000000..f2480b2 --- /dev/null +++ b/src/main/resources/persona/animal/scream-ghost.svg @@ -0,0 +1,316 @@ + + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/scream.svg b/src/main/resources/persona/animal/scream.svg new file mode 100644 index 0000000..466e6d7 --- /dev/null +++ b/src/main/resources/persona/animal/scream.svg @@ -0,0 +1,176 @@ + + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/slime-pumpkin-1.svg b/src/main/resources/persona/animal/slime-pumpkin-1.svg new file mode 100644 index 0000000..66a309f --- /dev/null +++ b/src/main/resources/persona/animal/slime-pumpkin-1.svg @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/animal/slime-pumpkin-2.svg b/src/main/resources/persona/animal/slime-pumpkin-2.svg new file mode 100644 index 0000000..e937a2e --- /dev/null +++ b/src/main/resources/persona/animal/slime-pumpkin-2.svg @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + *{contribution} + + + + + + + + + + + + + + + + + + + + *{level} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/persona/field/carrot-and-coin.svg b/src/main/resources/persona/field/carrot-and-coin.svg new file mode 100644 index 0000000..4cf5285 --- /dev/null +++ b/src/main/resources/persona/field/carrot-and-coin.svg @@ -0,0 +1,10 @@ + + *{username} + + + + + + *{commit-count} + +