-
Notifications
You must be signed in to change notification settings - Fork 7
✨ [Trader 15] 日替わり商人の作成 & 商人の日替わり更新システムの実装 #2169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
4177b2b
04a905e
d0fdf10
0781353
be88047
82de11f
513d8bf
d0626ae
9c47f34
1fe7a42
2da4fd8
3857414
424afc1
48c0386
d5a19a9
3b6f526
fc7c096
2499f00
1418510
ab8de54
60a6427
ad6aecc
7c5e853
ae7f49f
aaacb27
889cd29
cd40d9d
a632822
e0c2bfd
7f90bb0
40e946b
501d632
492f63f
66456cf
0ec6e6f
9425091
71af9d2
adf0219
1b51e16
304b900
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #> api:artifact/get_registry/blue | ||
| # | ||
| # | ||
| # | ||
| # @api | ||
|
|
||
| # ブルーシャードの神器プールを返す | ||
| data modify storage api: Return.Registry.Blue set from storage asset:artifact RarityRegistryWithColor.Blue |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #> api:artifact/get_registry/green | ||
| # | ||
| # | ||
| # | ||
| # @api | ||
|
|
||
| # グリーンシャードの神器プールを返す | ||
| data modify storage api: Return.Registry.Green set from storage asset:artifact RarityRegistryWithColor.Green |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #> api:artifact/get_registry/hide | ||
| # | ||
| # | ||
| # | ||
| # @api | ||
|
|
||
| # 隠し枠の神器プールを返す | ||
| data modify storage api: Return.Registry.Hide set from storage asset:artifact HideRarityRegistry |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #> api:artifact/get_registry/normal | ||
| # | ||
| # | ||
| # | ||
| # @api | ||
|
|
||
| # 通常シャードの神器プールを返す | ||
| data modify storage api: Return.Registry.Normal set from storage asset:artifact RarityRegistry |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #> api:artifact/get_registry/red | ||
| # | ||
| # | ||
| # | ||
| # @api | ||
|
|
||
| # レッドシャードの神器プールを返す | ||
| data modify storage api: Return.Registry.Red set from storage asset:artifact RarityRegistryWithColor.Red | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #> asset:trader/15/_index.d | ||
| # @private | ||
|
|
||
| #> tag | ||
| # @within function asset:trader/15/select_artifact/** | ||
| #declare score_holder $Current | ||
| #declare score_holder $UnlockLv1 | ||
| #declare score_holder $UnlockLv2 | ||
| #declare score_holder $UnlockLv3 | ||
| #declare score_holder $UnlockLv4 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #> asset:trader/15/register | ||
| # | ||
| # | ||
| # | ||
| # @within function asset_manager:trader/register/register.m | ||
|
|
||
| execute unless loaded 37 15 -6 run return 1 | ||
|
|
||
| # ID (int) | ||
| data modify storage asset:trader ID set value 15 | ||
| # Pos ([int] @ 3) | ||
| data modify storage asset:trader Pos set value [37,15,-6] | ||
| # 名前 (TextComponent) (オプション) | ||
| data modify storage asset:trader Name set value '{"text":"日替わり商人"}' | ||
| # 方向 (float) (オプション) | ||
| data modify storage asset:trader Rotation set value 180f | ||
|
|
||
| # 日替わりで更新する (boolean) | ||
| data modify storage asset:trader DailyUpdate set value true | ||
|
|
||
| # 売る神器を決める | ||
| function asset:trader/15/select_artifact/ | ||
|
|
||
| # プレイヤーの攻略度に対応した神器 | ||
| data modify storage asset:trader Trades append value {} | ||
| data modify storage asset:trader Trades[-1].BuyA set value {PresetItem:"currency/high",Count:8b} | ||
| data modify storage asset:trader Trades[-1].Sell set from storage asset:temp Sell.CurrentProgress | ||
| data modify storage asset:trader Trades[-1].MaxUses set value 1 | ||
|
|
||
| # プレイヤーの攻略段階までの神器 | ||
| data modify storage asset:trader Trades append value {} | ||
| data modify storage asset:trader Trades[-1].BuyA set value {PresetItem:"currency/high",Count:8b} | ||
| data modify storage asset:trader Trades[-1].Sell set from storage asset:temp Sell.UpToProgress | ||
| data modify storage asset:trader Trades[-1].MaxUses set value 1 | ||
|
|
||
| # リセット | ||
| data remove storage asset:temp Sell |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #> asset:trader/15/select_artifact/ | ||
| # | ||
| # | ||
| # | ||
| # @within function asset:trader/15/register | ||
|
|
||
| # 販売する神器をプールから選択する | ||
| # 1. 攻略段階に合ったランクの神器 | ||
| # 2. 攻略段階までのランクの神器 | ||
| # | ||
| # また、低確率で、このプールが隠し神器のプールに上書きされる | ||
|
|
||
| # 攻略度取得 | ||
| function api:global_vars/game_progress | ||
| execute store result score $Current Temporary run data get storage api: Return.Progress 100 | ||
|
|
||
| # globalで定義された攻略度によるシャード解放の割合をそれぞれ取得 | ||
| execute store result score $UnlockLv1 Temporary run data get storage global UnlockShardProgress[0] | ||
| execute store result score $UnlockLv2 Temporary run data get storage global UnlockShardProgress[1] | ||
| execute store result score $UnlockLv3 Temporary run data get storage global UnlockShardProgress[2] | ||
| execute store result score $UnlockLv4 Temporary run data get storage global UnlockShardProgress[3] | ||
|
|
||
| # APIで通常シャードのプールと隠し神器のプールを取得 | ||
| function api:artifact/get_registry/normal | ||
| function api:artifact/get_registry/hide | ||
|
Comment on lines
+24
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [NITS] |
||
|
|
||
| # 1, 2それぞれで神器を選択 | ||
| function asset:trader/15/select_artifact/current_progress/ | ||
| function asset:trader/15/select_artifact/up_to_progress/ | ||
|
|
||
| # リセット | ||
| scoreboard players reset $Current Temporary | ||
| scoreboard players reset $UnlockLv1 Temporary | ||
| scoreboard players reset $UnlockLv2 Temporary | ||
| scoreboard players reset $UnlockLv3 Temporary | ||
| scoreboard players reset $UnlockLv4 Temporary | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #> asset:trader/15/select_artifact/current_progress/ | ||
| # | ||
| # | ||
| # | ||
| # @within function asset:trader/15/select_artifact/ | ||
|
|
||
| # 攻略度段階に応じてプールを決める | ||
| # シャード村人に対応した攻略度で設定しておく | ||
|
|
||
| # プールを設定 | ||
| # Lv1は最初から買えるようにする | ||
| execute unless score $Current Temporary >= $UnlockLv2 Temporary run function asset:trader/15/select_artifact/current_progress/set_pool.m {Rarity:1} | ||
| execute if score $Current Temporary >= $UnlockLv2 Temporary unless score $Current Temporary >= $UnlockLv3 Temporary run function asset:trader/15/select_artifact/current_progress/set_pool.m {Rarity:2} | ||
| execute if score $Current Temporary >= $UnlockLv3 Temporary unless score $Current Temporary >= $UnlockLv4 Temporary run function asset:trader/15/select_artifact/current_progress/set_pool.m {Rarity:3} | ||
| execute if score $Current Temporary >= $UnlockLv4 Temporary run function asset:trader/15/select_artifact/current_progress/set_pool.m {Rarity:4} | ||
|
|
||
| # プールから神器を1つ抽出する | ||
| function lib:array/session/open | ||
| data modify storage lib: Array set from storage asset:temp Pool | ||
| function asset:trader/15/select_artifact/picks | ||
| data modify storage asset:temp Sell.CurrentProgress set from storage lib: Elements[] | ||
| function lib:array/session/close | ||
|
|
||
| # リセット | ||
| data remove storage asset:temp Pool |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #> asset:trader/15/select_artifact/current_progress/set_pool.m | ||
| # @input args: | ||
| # Rarity : int | ||
| # @within function asset:trader/15/select_artifact/current_progress/ | ||
|
|
||
| # プールを設定 | ||
| $data modify storage asset:temp Pool set from storage api: Return.Registry.Normal[$(Rarity)] | ||
|
|
||
| # 指定されたランクの隠し枠神器があれば、確率で隠し枠の神器のプールに置き換え | ||
| $execute if data storage api: Return.Registry.Hide[$(Rarity)][0] if predicate lib:random_pass_per/3 run data modify storage asset:temp Pool set from storage api: Return.Registry.Hide[$(Rarity)] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #> asset:trader/15/select_artifact/picks | ||
| # | ||
| # プールから1つの神器を選択する | ||
| # | ||
| # @within function | ||
| # asset:trader/15/select_artifact/current_progress/ | ||
| # asset:trader/15/select_artifact/up_to_progress/ | ||
| # asset:trader/15/select_artifact/picks | ||
|
|
||
| #> private | ||
| # @private | ||
| #declare score_holder $CandidatesLength | ||
| #declare score_holder $Random | ||
|
|
||
| # pickする | ||
| data modify storage lib: Picks set value [0] | ||
| execute store result score $CandidatesLength Temporary if data storage lib: Array[] | ||
| execute store result score $Random Temporary run random value 0..65535 | ||
| execute store result storage lib: Picks[0] int 1 run scoreboard players operation $Random Temporary %= $CandidatesLength Temporary | ||
| function lib:array/picks | ||
|
|
||
| # リセット | ||
| scoreboard players reset $Random Temporary | ||
| scoreboard players reset $CandidatesLength Temporary | ||
|
|
||
| # 選択した配列が2次元でかつ、要素数が2以上でなければ、次元を1減らしてreturnする | ||
| execute if data storage lib: Elements[][] unless data storage lib: Elements[][1] run return run data modify storage lib: Elements set from storage lib: Elements[] | ||
|
|
||
| # 1次元配列ならreturn | ||
| execute unless data storage lib: Elements[][] run return fail | ||
|
|
||
| # 配列の次元を1減らす | ||
| data modify storage lib: Array set from storage lib: Elements[] | ||
|
|
||
| # 再帰 | ||
| function asset:trader/15/select_artifact/picks |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #> asset:trader/15/select_artifact/up_to_progress/ | ||
| # | ||
| # | ||
| # | ||
| # @within function asset:trader/15/select_artifact/ | ||
|
|
||
| # 隠しプールにするかの判定 | ||
| execute if predicate lib:random_pass_per/3 run data modify storage asset:temp IsHidePool set value true | ||
|
|
||
| # プール初期化 | ||
| data modify storage asset:temp Pool set value [] | ||
|
|
||
| # プールを設定 | ||
| execute unless data storage asset:temp {IsHidePool:true} run function asset:trader/15/select_artifact/up_to_progress/set_pool.m {Type:"Normal"} | ||
| execute if data storage asset:temp {IsHidePool:true} run function asset:trader/15/select_artifact/up_to_progress/set_pool.m {Type:"Hide"} | ||
|
|
||
| # 要素数が0の場合、強制的に通常シャードのプールで上書きする (隠しプールの神器が0個である可能性があるため) | ||
| execute unless data storage asset:temp Pool[0] run function asset:trader/15/select_artifact/up_to_progress/set_pool.m {Type:"Normal"} | ||
|
|
||
| # プールから神器を1つ抽出する | ||
| function lib:array/session/open | ||
| data modify storage lib: Array set from storage asset:temp Pool | ||
| function asset:trader/15/select_artifact/picks | ||
| data modify storage asset:temp Sell.UpToProgress set from storage lib: Elements[] | ||
| function lib:array/session/close | ||
|
|
||
| # リセット | ||
| data remove storage asset:temp IsHidePool | ||
| data remove storage asset:temp Pool |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #> asset:trader/15/select_artifact/up_to_progress/set_pool.m | ||
| # @input args: | ||
| # Type : string (Normal | Hide) | ||
| # @within function asset:trader/15/select_artifact/up_to_progress/ | ||
|
|
||
| $data modify storage asset:temp Pool append from storage api: Return.Registry.$(Type)[1][] | ||
| $execute if score $Current Temporary >= $UnlockLv2 Temporary run data modify storage asset:temp Pool append from storage api: Return.Registry.$(Type)[2][] | ||
| $execute if score $Current Temporary >= $UnlockLv3 Temporary run data modify storage asset:temp Pool append from storage api: Return.Registry.$(Type)[3][] | ||
| $execute if score $Current Temporary >= $UnlockLv4 Temporary run data modify storage asset:temp Pool append from storage api: Return.Registry.$(Type)[4][] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| #> asset_manager:trader/common/refresh_trades/load_register.m | ||
| # @input args | ||
| # ID: int | ||
| # @within function asset_manager:trader/common/refresh_trades/m | ||
| # @within function asset_manager:trader/common/refresh_trades/ | ||
|
|
||
| $function asset:trader/$(ID)/register |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #> asset_manager:trader/common/update_recipe/by_daily | ||
| # | ||
| # | ||
| # | ||
| # @within function asset_manager:trader/daily_update | ||
|
|
||
| # 取引一覧を抽出 | ||
| function asset_manager:trader/common/update_recipe/get_trades | ||
| data modify storage asset:trader Trades set from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TraderData.Trades | ||
|
|
||
| # 取引を更新 | ||
| function asset_manager:trader/common/update_recipe/update |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #> asset_manager:trader/common/update_recipe/by_progress/ | ||
| # | ||
| # 商人のレシピを更新する | ||
| # | ||
| # @within function | ||
| # asset_manager:trader/tick/4_interval | ||
| # asset_manager:trader/daily_update | ||
| # asset_manager:trader/register/construct/set_data | ||
|
|
||
| # OhMyDat呼び出し | ||
| function oh_my_dat:please | ||
|
|
||
| # 日替わり商人の場合は現在の商品は維持し、攻略度だけ反映する | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [WANT]
|
||
| execute if entity @s[tag=Trader.DailyUpdate] run function asset_manager:trader/common/update_recipe/by_progress/keep_sells/ | ||
|
|
||
| # バージョンをチェックし、違うなら取引内容を更新する | ||
| function asset_manager:trader/common/update_recipe/by_progress/check_version.m with storage global | ||
|
|
||
| # storageに入れる | ||
| data modify storage asset:trader Trades set from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TraderData.Trades | ||
|
|
||
| # 取引を更新 | ||
| function asset_manager:trader/common/update_recipe/update | ||
|
|
||
| # バージョンを更新 | ||
| scoreboard players operation @s RecipeVersion = $TraderRecipeVersion Global | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #> asset_manager:trader/common/update_recipe/by_progress/check_version.m | ||
| # | ||
| # | ||
| # | ||
| # @within function asset_manager:trader/common/update_recipe/by_progress/ | ||
|
|
||
| # バージョンが不一致なことをチェックする | ||
| $execute if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TraderData{Version:"$(GameVersion)"} run return fail | ||
|
|
||
| # 一致してないならregisterから取引内容を取得 | ||
| function asset_manager:trader/common/update_recipe/get_trades |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #> asset_manager:trader/common/update_recipe/by_progress/keep_sells/ | ||
| # | ||
| # | ||
| # | ||
| # @within function asset_manager:trader/common/update_recipe/by_progress/ | ||
|
|
||
| # 取引データ取得 | ||
| function asset_manager:trader/common/update_recipe/get_trades | ||
|
|
||
| # 自身の取引データ取得 | ||
| data modify storage asset:trader TempA set from entity @s Offers.Recipes | ||
|
|
||
| # 更新後のデータを取得 | ||
| data modify storage asset:trader TempB set from storage asset:trader Trades | ||
|
|
||
| # 必要なデータだけ移す | ||
| function asset_manager:trader/common/update_recipe/by_progress/keep_sells/keep | ||
|
|
||
| # OhMyDatに戻す | ||
| data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TraderData.Trades set from storage asset:trader TempC | ||
|
|
||
| # リセット | ||
| data remove storage asset:trader TempA | ||
| data remove storage asset:trader TempB | ||
| data remove storage asset:trader TempC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[NITS]
説明を書け~~~~~~~~~~~~~~~~~~~~~
(他も同様だゾ)