├── .github
└── workflows
│ ├── Build.yml
│ ├── Releases.yml
│ └── docker_hkrpg-go-pe.yml
├── .gitignore
├── Dockerfile
├── LICENSE
├── README.md
├── README_zh-cn.md
├── build-dll.bat
├── build.bat
├── build.sh
├── cmd
├── dispatch
│ └── dispatch.go
├── gameserver
│ └── gameserver.go
├── gateserver
│ └── gateserver.go
├── hkrpg-go-dll
│ └── hkrpg-go-dll.go
├── hkrpg-go
│ └── hkrpg-go.go
├── muipserver
│ └── muipserver.go
├── nodeserver
│ └── nodeserver.go
├── push-server
│ └── push.go
└── robot
│ └── robot.go
├── conf
└── discord.example.json
├── data
├── ActivityScheduling.json
├── Banners.json
├── RogueMapGen.json
├── RogueTournRoomGen.json
├── SpecialProp.json
├── TextMap
│ ├── TextMapCHT.json
│ ├── TextMapCN.json
│ └── TextMapEN.json
└── VideoVersionKey.json
├── dbconf
├── init.go
├── mail.go
└── rogue.go
├── dispatch
├── app
│ └── app.go
├── config.go
├── sdk
│ ├── api.go
│ ├── combo.go
│ ├── common.go
│ ├── mdk.go
│ ├── plutus.go
│ ├── query.go
│ ├── router.go
│ └── sdk.go
└── service
│ └── service.go
├── docker
└── hkrpg-go
│ └── Dockerfile
├── docs
├── README-FR.md
├── README-JP.md
├── README-KR.md
├── README-RU.md
├── README-VI.md
├── README_zh-CN.md
├── README_zh-TW.md
├── api
│ ├── EN.md
│ ├── FR.md
│ ├── JP.md
│ ├── KR.md
│ ├── RU.md
│ ├── VI.md
│ ├── zh-CN.md
│ └── zh-TW.md
├── conf
│ ├── EN.md
│ ├── FR.md
│ ├── JP.md
│ ├── KR.md
│ ├── RU.md
│ ├── VI.md
│ ├── zh-CN.md
│ └── zh-TW.md
├── progress
│ ├── EN.md
│ ├── FR.md
│ ├── JP.md
│ ├── KR.md
│ ├── RU.md
│ ├── VI.md
│ ├── zh-CN.md
│ └── zh-TW.md
├── rebirth
│ ├── EN.md
│ ├── FR.md
│ ├── JP.md
│ ├── KR.md
│ ├── RU.md
│ ├── VI.md
│ ├── zh-CN.md
│ └── zh-TW.md
├── tutorial
│ ├── EN.md
│ ├── FR.md
│ ├── JP.md
│ ├── KR.md
│ ├── RU.md
│ ├── VI.md
│ ├── zh-CN.md
│ └── zh-TW.md
├── 差分宇宙地图解析.ini
└── 模拟宇宙场景选择原理.ini
├── gameserver
├── app
│ └── app.go
├── config.go
├── model
│ ├── db_activity.go
│ ├── db_activity_aether_divide.go
│ ├── db_activity_clock_park.go
│ ├── db_activity_match_three.go
│ ├── db_activity_music_rhythm.go
│ ├── db_activity_trial.go
│ ├── db_avatar.go
│ ├── db_base.go
│ ├── db_battle.go
│ ├── db_challenge.go
│ ├── db_change_story.go
│ ├── db_friend.go
│ ├── db_gacha.go
│ ├── db_handbook.go
│ ├── db_item.go
│ ├── db_lineup.go
│ ├── db_mail.go
│ ├── db_mission.go
│ ├── db_npc.go
│ ├── db_player.go
│ ├── db_quest_rogue.go
│ ├── db_raid.go
│ ├── db_rogue.go
│ ├── db_rogue_quest.go
│ ├── db_rogue_tourn.go
│ ├── db_scene.go
│ ├── db_shop.go
│ ├── db_train.go
│ └── test_scene.go
├── player
│ ├── command.go
│ ├── player.go
│ ├── player_activity.go
│ ├── player_activity_aether_divide.go
│ ├── player_activity_clock_park.go
│ ├── player_activity_match_three.go
│ ├── player_activity_music_rhythm.go
│ ├── player_activity_sword_training.go
│ ├── player_activity_trial.go
│ ├── player_avatar.go
│ ├── player_base.go
│ ├── player_battle.go
│ ├── player_challenge.go
│ ├── player_change_story.go
│ ├── player_friend.go
│ ├── player_gacha.go
│ ├── player_item.go
│ ├── player_lineup.go
│ ├── player_login.go
│ ├── player_mail.go
│ ├── player_mission.go
│ ├── player_npc.go
│ ├── player_player.go
│ ├── player_query.go
│ ├── player_quest.go
│ ├── player_quest_rogue.go
│ ├── player_raid.go
│ ├── player_rogue.go
│ ├── player_rogue_quest.go
│ ├── player_rogue_tourn.go
│ ├── player_scene.go
│ ├── player_shop.go
│ ├── player_train.go
│ ├── router.go
│ └── test_mission.go
└── service
│ └── service.go
├── gateserver
├── app
│ └── app.go
├── config.go
├── service
│ ├── packet.go
│ ├── server_msg.go
│ └── service.go
└── session
│ ├── conn.go
│ ├── kcp_conn.go
│ ├── session.go
│ └── tcp_conn.go
├── gdconf
├── activity_login_config.go
├── activity_panel.go
├── activity_scheduling.go
├── adventure_player.go
├── aether_divide_challenge_list.go
├── aether_divide_passive_skill.go
├── aether_divide_spirit.go
├── aether_divide_spirit_trial.go
├── avatar_config.go
├── avatar_demo_config.go
├── avatar_expItem_config.go
├── avatar_maze_buff.go
├── avatar_player_icon.go
├── avatar_promotion_config.go
├── avatar_skilltree.go
├── back_ground_music.go
├── banners.go
├── callenge_group_config.go
├── challenge_maze_config.go
├── challenge_reward_line.go
├── challenge_story_maze_extra.go
├── challenge_target_config.go
├── chat_bubble_config.go
├── city_shop_reward_list.go
├── clock_park_script_config.go
├── cocoon_config.go
├── config_adventure_ability.go
├── content_package_config.go
├── daily_mission_data.go
├── equipment_data.go
├── equipment_exp_type.go
├── equipment_promotion_config.go
├── equipment_skill_config.go
├── event_mission.go
├── exp_type.go
├── farm_element_config.go
├── floor.go
├── func_unlock_data.go
├── game_data_config.go
├── gopp_ability.go
├── gopp_main_mission.go
├── gopp_rogue_room.go
├── gopp_server_floor.go
├── gopp_server_group.go
├── gopp_teleports.go
├── group.go
├── group_system_unlock_data.go
├── interact_config.go
├── item_compose_config.go
├── item_config.go
├── item_use_buff_data.go
├── item_use_data.go
├── loading_desc.go
├── main_mission.go
├── map_entrance.go
├── mapping_info.go
├── match_three_bird.go
├── match_three_level.go
├── maze_buff.go
├── maze_plane.go
├── maze_prop.go
├── maze_skill.go
├── message_group_config.go
├── message_section_config.go
├── monster_config.go
├── monster_drop.go
├── multiple_path_avatar_config.go
├── music_rhythm_track.go
├── npc_data.go
├── npc_monster_data.go
├── pet_config.go
├── phone_theme_config.go
├── plane_event.go
├── player_level_config.go
├── quest_data.go
├── raid_config.go
├── relic_data.go
├── relic_exp_type.go
├── relic_main_affix_config.go
├── relic_sub_affix_config.go
├── reward_data.go
├── rogue_aeon_story_config.go
├── rogue_area_config.go
├── rogue_bonus.go
├── rogue_buff.go
├── rogue_hand_book_event.go
├── rogue_handbook_miracle.go
├── rogue_manager.go
├── rogue_map.go
├── rogue_map_gen.go
├── rogue_maze_buff.go
├── rogue_monster.go
├── rogue_monster_group.go
├── rogue_score_reward.go
├── rogue_talent.go
├── rogue_tourn_area.go
├── rogue_tourn_difficulty_comp.go
├── rogue_tourn_exp_reward.go
├── rogue_tourn_exp_score.go
├── rogue_tourn_formula.go
├── rogue_tourn_permanent_talent.go
├── rogue_tourn_room_gen.go
├── shop_config.go
├── shop_goods_config.go
├── special_avatar.go
├── special_prop.go
├── stage_config.go
├── story_line.go
├── story_line_floor_data.go
├── stroy_line_trial_avatar_data.go
├── summon_unit_data.go
├── text_join_config.go
├── train_party_area_config.go
├── train_party_area_goal_config.go
├── train_party_card_config.go
├── train_party_passenger_config.go
├── train_party_step_config.go
├── train_visitor_config.go
├── tutorial_data.go
├── tutorial_guide_group.go
└── video_version_key.go
├── go.mod
├── go.sum
├── hkrpg-go-pe
├── command.go
├── config.go
├── new_server.go
└── packet.go
├── muipserver
├── api
│ └── api.go
├── app
│ └── app.go
├── config
│ └── config.go
└── db
│ └── start.go
├── nodeserver
├── api
│ ├── node.pb.go
│ └── node_grpc.pb.go
├── app
│ └── app.go
├── config
│ └── config.go
└── service
│ ├── message_queue.go
│ └── service.go
├── pkg
├── alg
│ ├── endecode.go
│ ├── getec2b.go
│ ├── http.go
│ ├── math.go
│ ├── parameters.go
│ ├── status.go
│ └── tcp_endecode.go
├── build.go
├── constant
│ ├── activity.go
│ ├── banner.go
│ ├── command.go
│ ├── config.go
│ ├── db.go
│ ├── item.go
│ ├── mission.go
│ ├── push.go
│ ├── raid.go
│ ├── rogue.go
│ ├── scene.go
│ ├── sdk.go
│ ├── skill_action.go
│ └── train_party.go
├── database
│ ├── conf.go
│ ├── new.go
│ ├── player.go
│ ├── push.go
│ ├── redis.go
│ ├── store.go
│ └── user.go
├── email
│ └── email.go
├── endec
│ ├── endec.go
│ └── endec_test.go
├── kcp
│ ├── enet.go
│ ├── kcp.go
│ ├── session.go
│ ├── snmp.go
│ ├── timedsched.go
│ ├── udp_socket.go
│ ├── udp_socket_darwin.go
│ ├── udp_socket_linux.go
│ └── udp_socket_windows.go
├── logger
│ ├── logger.go
│ ├── logger_linux.go
│ └── logger_windows.go
├── lua
│ └── lua.go
├── mq
│ ├── msg.go
│ ├── sock.go
│ └── topic.go
├── push
│ ├── build.go
│ ├── client
│ │ ├── nopush.go
│ │ └── push.go
│ └── server
│ │ ├── README.md
│ │ ├── config.go
│ │ ├── log.go
│ │ ├── router.go
│ │ ├── server.go
│ │ └── webhook.go
├── random
│ ├── hk4e_mt19937.go
│ ├── hkrpg_ec2b.go
│ ├── hkrpg_magic.go
│ └── random.go
├── rpc
│ └── client.go
├── sys
│ ├── sys_darwin.go
│ ├── sys_linux.go
│ └── sys_windows.go
└── text
│ └── text_map.go
├── protocol
├── build_proto.bat
├── build_server_proto.bat
├── cmd
│ ├── cmd_id.go
│ ├── cmd_id_proto_obj_map.go
│ └── proto_endecode.go
├── proto
│ └── StarRail_2.7.51_Danheng.pb.go
├── rpcapi
│ └── node.proto
└── server
│ ├── cmd_id.go
│ ├── cmd_id_proto_obj_map.go
│ ├── proto
│ ├── bin.server.activity.pb.go
│ ├── bin.server.activity.proto
│ ├── bin.server.handbook.pb.go
│ ├── bin.server.handbook.proto
│ ├── bin.server.pb.go
│ ├── bin.server.proto
│ ├── bin.server.rogue.pb.go
│ ├── bin.server.rogue.proto
│ ├── cmd.server.pb.go
│ ├── cmd.server.proto
│ ├── common.server.pb.go
│ ├── common.server.proto
│ ├── enum.server.pb.go
│ ├── enum.server.proto
│ ├── redis_data.pb.go
│ └── redis_data.proto
│ └── proto_endecode.go
├── robot
├── config
│ └── config.go
└── robot
│ ├── game.go
│ ├── game_login.go
│ ├── game_scene.go
│ ├── http_login.go
│ ├── proto_endecode.go
│ └── router.go
├── start.sh
├── suppl
├── discord
│ ├── command
│ │ ├── binding.go
│ │ ├── command.go
│ │ └── info.go
│ ├── config.go
│ └── discord.go
├── pushc
│ └── push.go
└── suppl.go
├── tools
├── android
│ └── install.sh
├── dump.py
└── rebirth
│ ├── README.md
│ ├── playerbin.go
│ └── rebirth.go
└── 唐
├── 唐璃.png
└── 唐璃2.png
/.github/workflows/Build.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 | on:
3 | workflow_dispatch:
4 |
5 | jobs:
6 | build:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - name: Sync HKRPG-Go
10 | uses: actions/checkout@v3
11 | with:
12 | repository: gucooing/hkrpg-go
13 | ref: "dev"
14 | fetch-depth: 0
15 |
16 | - name: Set up Go
17 | uses: actions/setup-go@v4
18 | with:
19 | go-version: "1.22.1"
20 | check-latest: true
21 |
22 | - name: Build
23 | run: bash build.sh
24 |
25 | - name: Upload data
26 | uses: actions/upload-artifact@v4
27 | with:
28 | name: data.zip
29 | path: data/*
30 |
31 | - name: Upload docs
32 | uses: actions/upload-artifact@v4
33 | with:
34 | name: docs.zip
35 | path: docs/*
36 |
37 | - name: Upload linux-amd64
38 | uses: actions/upload-artifact@v4
39 | with:
40 | name: linux-amd64.zip
41 | path: build/linux-amd64/*
42 |
43 | - name: Upload linux-arm64
44 | uses: actions/upload-artifact@v4
45 | with:
46 | name: linux-arm64.zip
47 | path: build/linux-arm64/*
48 |
49 | - name: Upload windows-amd64
50 | uses: actions/upload-artifact@v4
51 | with:
52 | name: windows-amd64.zip
53 | path: build/windows-amd64/*
54 |
55 | - name: Upload windows-arm64
56 | uses: actions/upload-artifact@v4
57 | with:
58 | name: windows-arm64.zip
59 | path: build/windows-arm64/*
--------------------------------------------------------------------------------
/.github/workflows/Releases.yml:
--------------------------------------------------------------------------------
1 | name: HKRPG-Go Releases
2 | on:
3 | workflow_dispatch:
4 |
5 | jobs:
6 | build:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - name: Sync HKRPG-Go
10 | uses: actions/checkout@v3
11 | with:
12 | repository: gucooing/hkrpg-go
13 | ref: "dev"
14 | fetch-depth: 0
15 |
16 | - name: Set up Go
17 | uses: actions/setup-go@v4
18 | with:
19 | go-version: "1.22.4"
20 | check-latest: true
21 |
22 | - name: Build
23 | run: bash build.sh
24 |
25 | - name: Package
26 | run: |
27 | mkdir bin
28 | zip -r bin/data.zip data/*
29 | zip -r bin/linux-amd64.zip build/linux-amd64/*
30 | zip -r bin/linux-arm64.zip build/linux-arm64/*
31 | zip -r bin/windows-amd64.zip build/windows-amd64/*
32 | zip -r bin/windows-arm64.zip build/windows-arm64/*
33 |
34 | - name: Upload Release Assets
35 | id: upload-release-assets
36 | uses: softprops/action-gh-release@v1
37 | with:
38 | repository: gucooing/hkrpg-go
39 | token: ${{ secrets.TOKEN }}
40 | tag_name: v1.6.0
41 | name: Release v1.6.0
42 | body: sr 2.6.0
43 | draft: false
44 | prerelease: false
45 | files: bin/*
--------------------------------------------------------------------------------
/.github/workflows/docker_hkrpg-go-pe.yml:
--------------------------------------------------------------------------------
1 | name: Docker hkrpg-go-pe
2 |
3 | on:
4 | workflow_dispatch:
5 |
6 | jobs:
7 |
8 | build:
9 |
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - name: Sync HKRPG-Go
14 | uses: actions/checkout@v3
15 | with:
16 | repository: gucooing/hkrpg-go
17 | ref: "dev"
18 | fetch-depth: 0
19 |
20 | - name: Docker login
21 | uses: docker/login-action@v1.8.0
22 | with:
23 | username: "${{ secrets.DOCKERHUB_USERNAME }}"
24 | password: "${{ secrets.DOCKERHUB_PASSWORD }}"
25 |
26 | - name: Build the Docker image
27 | run: |
28 | SHA=${{ github.sha }}
29 | docker build -t gucooing/hkrpg-go-pe:latest -t gucooing/hkrpg-go-pe:$SHA -f docker/hkrpg-go/Dockerfile .
30 | docker push gucooing/hkrpg-go-pe:$SHA
31 | docker push gucooing/hkrpg-go-pe:latest
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # linux amd64
2 | FROM golang:1.23-alpine as linuxamd64
3 | LABEL authors="gucooing"
4 |
5 | RUN apk add --no-cache bash
6 | WORKDIR /usr/hkrpg
7 | ADD go.mod .
8 | ADD go.sum .
9 | RUN go mod download && go mod verify
10 | COPY . .
11 | RUN go build -tags netgo -o /usr/hkrpg/hkrpg-go ./cmd/hkrpg-go-pe/hkrpg-go.go
12 |
13 | # linux arm64
14 | FROM --platform=linux/arm64 golang:1.23-alpine as linuxarm64
15 | RUN apk add --no-cache bash
16 | WORKDIR /usr/hkrpg
17 | ADD go.mod .
18 | ADD go.sum .
19 | RUN go mod download && go mod verify
20 | COPY . .
21 | RUN go build -tags netgo -o /usr/hkrpg/hkrpg-go ./cmd/hkrpg-go-pe/hkrpg-go.go
22 |
23 |
24 |
25 | FROM alpine:latest
26 | RUN apk add --no-cache git bash
27 | WORKDIR /usr/hkrpg
28 | COPY --from=builder /usr/hkrpg/hkrpg-go /usr/hkrpg/hkrpg-go
29 | COPY --from=builder /usr/hkrpg/data/ /usr/hkrpg/data/
30 | COPY --from=builder /usr/hkrpg/start.sh /usr/hkrpg/start.sh
31 | RUN chmod +x /usr/hkrpg/start.sh
32 | EXPOSE 8080/tcp 20041/udp
33 | ENTRYPOINT ["bash","start.sh"]
--------------------------------------------------------------------------------
/build-dll.bat:
--------------------------------------------------------------------------------
1 | go build -buildmode=c-shared -o .\build\hkrpg-go.dll .\cmd\hkrpg-go-dll\hkrpg-go-dll.go
--------------------------------------------------------------------------------
/build.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | setlocal enabledelayedexpansion
3 |
4 | go mod download
5 | go mod verify
6 | set CGO_ENABLED=0
7 |
8 | set "PLATFORMS=windows/amd64 windows/arm64 linux/amd64 linux/arm64"
9 |
10 | set "OUT_DIR=./build"
11 |
12 | set "PE_PATH=.\cmd\hkrpg-go\hkrpg-go.go"
13 | set "DISPATCH_PATH=.\cmd\dispatch\dispatch.go"
14 | set "GAMESERVER_PATH=.\cmd\gameserver\gameserver.go"
15 | set "GATE_PATH=.\cmd\gateserver\gateserver.go"
16 | set "MUIP_PATH=.\cmd\muipserver\muipserver.go"
17 | set "NODE_PATH=.\cmd\nodeserver\nodeserver.go"
18 | set "ROBOT_PATH=.\cmd\robot\robot.go"
19 |
20 | for %%p in (%PLATFORMS%) do (
21 | for /f "tokens=1,2 delims=/" %%a in ("%%p") do (
22 | set "GOOS=%%a"
23 | set "GOARCH=%%b"
24 |
25 | echo Compiling for GOOS=!GOOS! GOARCH=!GOARCH!...
26 |
27 | set "CURRENT_OUT_DIR=!OUT_DIR!/!GOOS!-!GOARCH!"
28 | if not exist "!CURRENT_OUT_DIR!" mkdir "!CURRENT_OUT_DIR!"
29 |
30 |
31 | for %%f in ("%PE_PATH%" "%DISPATCH_PATH%" "%GAMESERVER_PATH%" "%GATE_PATH%" "%MUIP_PATH%" "%NODE_PATH%" "%ROBOT_PATH%") do (
32 | set "FILENAME=%%~nxf"
33 | set "OUTPUT_NAME=%%~nf"
34 |
35 | if "!GOOS!"=="windows" (
36 | go build -tags=push -ldflags="-s -w" -o "!CURRENT_OUT_DIR!/!OUTPUT_NAME!_!GOOS!_!GOARCH!.exe" %%f
37 | ) else (
38 | go build -tags=push -ldflags="-s -w" -o "!CURRENT_OUT_DIR!/!OUTPUT_NAME!_!GOOS!_!GOARCH!" %%f
39 | )
40 | )
41 | )
42 | )
43 |
44 | endlocal
45 |
--------------------------------------------------------------------------------
/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | if command -v go &> /dev/null; then
3 | echo "Go 环境已安装"
4 | go version
5 | else
6 | echo "Go 环境未安装"
7 | exit 1
8 | fi
9 |
10 | go mod download
11 | go mod verify
12 | export CGO_ENABLED=0
13 |
14 | PLATFORMS="linux/amd64 linux/arm64 windows/amd64 windows/arm64"
15 |
16 | OUT_DIR=./build
17 |
18 | PE_PATH=./cmd/hkrpg-go/hkrpg-go.go
19 | DISPATCH_PATH=./cmd/dispatch/dispatch.go
20 | GAMESERVER_PATH=./cmd/gameserver/gameserver.go
21 | GATE_PATH=./cmd/gateserver/gateserver.go
22 | MUIP_PATH=./cmd/muipserver/muipserver.go
23 | NODE_PATH=./cmd/nodeserver/nodeserver.go
24 | ROBOT_PATH=./cmd/robot/robot.go
25 |
26 | for file in $PE_PATH $DISPATCH_PATH $GAMESERVER_PATH $GATE_PATH $MUIP_PATH $NODE_PATH $ROBOT_PATH; do
27 | for platform in $PLATFORMS; do
28 | export GOOS=$(echo $platform | cut -d'/' -f1)
29 | export GOARCH=$(echo $platform | cut -d'/' -f2)
30 | CURRENT_OUT_DIR=$OUT_DIR/$GOOS-$GOARCH
31 | FILENAME=$(basename $file)
32 | OUTPUT_NAME=${FILENAME%.*}_$GOOS"_"$GOARCH
33 | if [ $GOOS = "windows" ]; then
34 | OUTPUT_NAME="$OUTPUT_NAME.exe"
35 | fi
36 | echo "Building $OUTPUT_NAME..."
37 | go build -ldflags="-s -w" -o $CURRENT_OUT_DIR/$OUTPUT_NAME $file
38 | done
39 | done
--------------------------------------------------------------------------------
/cmd/dispatch/dispatch.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "encoding/json"
5 | "fmt"
6 | "os"
7 | "os/signal"
8 | "strings"
9 | "syscall"
10 |
11 | "github.com/gucooing/hkrpg-go/dispatch"
12 | "github.com/gucooing/hkrpg-go/dispatch/app"
13 | "github.com/gucooing/hkrpg-go/pkg"
14 | "github.com/gucooing/hkrpg-go/pkg/alg"
15 | "github.com/gucooing/hkrpg-go/pkg/logger"
16 | )
17 |
18 | func main() {
19 | // 启动读取配置
20 | confName := "dispatch.json"
21 | err := dispatch.LoadConfig(confName)
22 | if err != nil {
23 | if err == dispatch.FileNotExist {
24 | p, _ := json.MarshalIndent(dispatch.DefaultConfig, "", " ")
25 | cf, _ := os.Create("./conf/" + confName)
26 | cf.Write(p)
27 | cf.Close()
28 | fmt.Printf("找不到配置文件\n已生成默认配置文件 %s \n", confName)
29 | return
30 | } else {
31 | panic(err)
32 | }
33 | }
34 | appid := alg.GetAppId()
35 | // 初始化日志
36 | logger.InitLogger("discord"+"["+appid+"]", strings.ToUpper(dispatch.GetConfig().LogLevel))
37 | logger.Info("hkrpg-go")
38 | logger.Info("AppVersion:%s", pkg.GetAppVersion())
39 | logger.Info("GameVersion:%s", pkg.GetGameVersion())
40 | cfg := dispatch.GetConfig()
41 |
42 | done := make(chan os.Signal, 1)
43 | signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
44 |
45 | if err = app.Run(done, cfg, appid); err != nil {
46 | logger.Error(err.Error())
47 | logger.CloseLogger()
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/cmd/gameserver/gameserver.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "encoding/json"
5 | "fmt"
6 | "os"
7 | "os/signal"
8 | "strings"
9 | "syscall"
10 |
11 | "github.com/gucooing/hkrpg-go/gameserver"
12 | "github.com/gucooing/hkrpg-go/gameserver/app"
13 | "github.com/gucooing/hkrpg-go/pkg"
14 | "github.com/gucooing/hkrpg-go/pkg/alg"
15 | "github.com/gucooing/hkrpg-go/pkg/logger"
16 | )
17 |
18 | func main() {
19 | // 启动读取配置
20 | confName := "gameserver.json"
21 | err := gameserver.LoadConfig(confName)
22 | if err != nil {
23 | if err == gameserver.FileNotExist {
24 | p, _ := json.MarshalIndent(gameserver.DefaultConfig, "", " ")
25 | cf, _ := os.Create("./conf/" + confName)
26 | cf.Write(p)
27 | cf.Close()
28 | fmt.Printf("找不到配置文件\n已生成默认配置文件 %s \n", confName)
29 | return
30 | } else {
31 | panic(err)
32 | }
33 | }
34 | appid := alg.GetAppId()
35 | cfg := gameserver.GetConfig()
36 | // 初始化日志
37 | logger.InitLogger("gameserver"+"["+appid+"]", strings.ToUpper(cfg.LogLevel))
38 | logger.Info("hkrpg-go")
39 | logger.Info("AppVersion:%s", pkg.GetAppVersion())
40 | logger.Info("GameVersion:%s", pkg.GetGameVersion())
41 | done := make(chan os.Signal, 1)
42 | signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
43 | if err = app.Run(done, cfg, appid); err != nil {
44 | logger.Error(err.Error())
45 | logger.CloseLogger()
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/cmd/gateserver/gateserver.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "encoding/json"
5 | "fmt"
6 | "os"
7 | "os/signal"
8 | "strings"
9 | "syscall"
10 |
11 | "github.com/gucooing/hkrpg-go/gateserver"
12 | "github.com/gucooing/hkrpg-go/gateserver/app"
13 | "github.com/gucooing/hkrpg-go/pkg"
14 | "github.com/gucooing/hkrpg-go/pkg/alg"
15 | "github.com/gucooing/hkrpg-go/pkg/logger"
16 | )
17 |
18 | func main() {
19 | // 启动读取配置
20 | confName := "gateserver.json"
21 | err := gateserver.LoadConfig(confName)
22 | if err != nil {
23 | if err == gateserver.FileNotExist {
24 | p, _ := json.MarshalIndent(gateserver.DefaultConfig, "", " ")
25 | cf, _ := os.Create("./conf/" + confName)
26 | cf.Write(p)
27 | cf.Close()
28 | fmt.Printf("找不到配置文件\n已生成默认配置文件 %s \n", confName)
29 | return
30 | } else {
31 | panic(err)
32 | }
33 | }
34 | appid := alg.GetAppId()
35 | // 初始化日志
36 | logger.InitLogger("gateserver"+"["+appid+"]", strings.ToUpper(gateserver.GetConfig().LogLevel))
37 | logger.Info("hkrpg-go")
38 | logger.Info("AppVersion:%s", pkg.GetAppVersion())
39 | logger.Info("GameVersion:%s", pkg.GetGameVersion())
40 | done := make(chan os.Signal, 1)
41 | signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
42 | cfg := gateserver.GetConfig()
43 |
44 | if err = app.Run(done, cfg, appid); err != nil {
45 | logger.Error(err.Error())
46 | logger.CloseLogger()
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/cmd/muipserver/muipserver.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "encoding/json"
5 | "fmt"
6 | "os"
7 | "os/signal"
8 | "strings"
9 | "syscall"
10 |
11 | "github.com/gucooing/hkrpg-go/muipserver/config"
12 | "github.com/gucooing/hkrpg-go/pkg"
13 | "github.com/gucooing/hkrpg-go/pkg/alg"
14 | "github.com/gucooing/hkrpg-go/pkg/logger"
15 | )
16 |
17 | func main() {
18 | confName := "muipserver.json"
19 | err := config.LoadConfig(confName)
20 | if err != nil {
21 | if err == config.FileNotExist {
22 | p, _ := json.MarshalIndent(config.DefaultConfig, "", " ")
23 | cf, _ := os.Create("./conf/" + confName)
24 | cf.Write(p)
25 | cf.Close()
26 | fmt.Printf("找不到配置文件\n已生成默认配置文件 %s \n", confName)
27 | return
28 | } else {
29 | panic(err)
30 | }
31 | }
32 | appid := alg.GetAppId()
33 | // 初始化日志
34 | logger.InitLogger("muipserver"+"["+appid+"]", strings.ToUpper(config.GetConfig().LogLevel))
35 | logger.Info("hkrpg-go")
36 | logger.Info("AppVersion:%s", pkg.GetAppVersion())
37 | done := make(chan os.Signal, 1)
38 | signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
39 | // cfg := config.GetConfig()
40 | }
41 |
--------------------------------------------------------------------------------
/cmd/nodeserver/nodeserver.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "os"
6 | "os/signal"
7 | "strings"
8 | "syscall"
9 |
10 | "github.com/goccy/go-json"
11 | "github.com/gucooing/hkrpg-go/nodeserver/app"
12 | "github.com/gucooing/hkrpg-go/nodeserver/config"
13 | "github.com/gucooing/hkrpg-go/pkg"
14 | "github.com/gucooing/hkrpg-go/pkg/alg"
15 | "github.com/gucooing/hkrpg-go/pkg/logger"
16 | )
17 |
18 | func main() {
19 | // 启动读取配置
20 | confName := "nodeserver.json"
21 | err := config.LoadConfig(confName)
22 | if err != nil {
23 | if err == config.FileNotExist {
24 | p, _ := json.MarshalIndent(config.DefaultConfig, "", " ")
25 | cf, _ := os.Create("./conf/" + confName)
26 | cf.Write(p)
27 | cf.Close()
28 | fmt.Printf("找不到配置文件\n已生成默认配置文件 %s \n", confName)
29 | return
30 | } else {
31 | panic(err)
32 | }
33 | }
34 | // 初始化日志
35 | appid := alg.GetAppId()
36 | logger.InitLogger("nodeserver"+"["+appid+"]", strings.ToUpper(config.GetConfig().LogLevel))
37 | logger.Info("hkrpg-go")
38 | logger.Info("AppVersion:%s", pkg.GetAppVersion())
39 | cfg := config.GetConfig()
40 |
41 | done := make(chan os.Signal, 1)
42 | signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
43 | if err = app.Run(done, cfg, appid); err != nil {
44 | logger.Error("node server error:%s", err.Error())
45 | logger.CloseLogger()
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/cmd/push-server/push.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "encoding/json"
5 | "fmt"
6 | "os"
7 | "os/signal"
8 | "strings"
9 | "syscall"
10 |
11 | "github.com/gucooing/hkrpg-go/pkg/logger"
12 | "github.com/gucooing/hkrpg-go/pkg/push"
13 | "github.com/gucooing/hkrpg-go/pkg/push/server"
14 | )
15 |
16 | func main() {
17 | confName := "push.json"
18 | err := server.LoadConfig(confName)
19 | if err != nil {
20 | if err == server.FileNotExist {
21 | p, _ := json.MarshalIndent(server.DefaultConfig, "", " ")
22 | cf, _ := os.Create("./conf/" + confName)
23 | cf.Write(p)
24 | cf.Close()
25 | fmt.Printf("找不到配置文件\n已生成默认配置文件 %s \n", confName)
26 | return
27 | } else {
28 | panic(err)
29 | }
30 | }
31 | cfg := server.GetConfig()
32 | logger.InitLogger("push", strings.ToUpper(cfg.LogLevel))
33 | logger.Info("push server AppVersion:%s", push.AppVersion)
34 |
35 | done := make(chan os.Signal, 1)
36 | signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
37 |
38 | if err = server.NewServer(done, cfg); err != nil {
39 | logger.Error(err.Error())
40 | logger.CloseLogger()
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/cmd/robot/robot.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "encoding/json"
5 | "fmt"
6 | "os"
7 | "os/signal"
8 | "strings"
9 | "syscall"
10 | "time"
11 |
12 | "github.com/gucooing/hkrpg-go/gdconf"
13 | "github.com/gucooing/hkrpg-go/pkg"
14 | "github.com/gucooing/hkrpg-go/pkg/logger"
15 | "github.com/gucooing/hkrpg-go/robot/config"
16 | "github.com/gucooing/hkrpg-go/robot/robot"
17 | "golang.org/x/net/context"
18 | )
19 |
20 | func main() {
21 | // 启动读取配置
22 | confName := "robot.json"
23 | err := config.LoadConfig(confName)
24 | if err != nil {
25 | if err == config.FileNotExist {
26 | p, _ := json.MarshalIndent(config.DefaultConfig, "", " ")
27 | cf, _ := os.Create("./conf/" + confName)
28 | cf.Write(p)
29 | cf.Close()
30 | fmt.Printf("找不到配置文件\n已生成默认配置文件 %s \n", confName)
31 | return
32 | } else {
33 | panic(err)
34 | }
35 | }
36 | // 初始化日志
37 | logger.InitLogger("robot", strings.ToUpper(config.GetConfig().LogLevel))
38 | logger.Info("hkrpg-robot-go")
39 | logger.Info("AppVersion:%s", pkg.GetAppVersion())
40 | logger.Info("GameVersion:%s", pkg.GetGameVersion())
41 |
42 | gdconf.InitGameDataConfig(config.GetConfig().GameDataConfigPath)
43 |
44 | done := make(chan os.Signal, 1)
45 | signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
46 |
47 | go func() {
48 | robot.NewBot()
49 | }()
50 |
51 | go robot.KcpNetInfo()
52 |
53 | go func() {
54 | select {
55 | case <-done:
56 | _, cancel := context.WithTimeout(context.Background(), 5*time.Second)
57 | defer cancel()
58 | logger.Info("服务已停止")
59 | logger.CloseLogger()
60 | os.Exit(0)
61 | }
62 | }()
63 |
64 | select {}
65 | }
66 |
--------------------------------------------------------------------------------
/conf/discord.example.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "Bot",
3 | "token": "token",
4 | "db": {
5 | "type": "sqlite",
6 | "dns": "./conf/discord.db"
7 | }
8 | }
--------------------------------------------------------------------------------
/data/RogueMapGen.json:
--------------------------------------------------------------------------------
1 | {
2 | "1": [1],
3 | "4": [6],
4 | "5": [5],
5 | "6": [1],
6 | "8": [6],
7 | "9": [5],
8 | "10": [2,3],
9 | "12": [5],
10 | "13": [7],
11 | "21": [2],
12 | "22": [3],
13 | "31": [2],
14 | "32": [3],
15 | "71": [3,4],
16 | "72": [2,4],
17 | "111": [2,3],
18 | "112": [4,8]
19 | }
--------------------------------------------------------------------------------
/data/SpecialProp.json:
--------------------------------------------------------------------------------
1 | {
2 | "2000401": {
3 | "EntryId": 2000401,
4 | "GroupList": {
5 | "42":{
6 | "GroupId": 42,
7 | "PropState": {
8 | "300002": "Open"
9 | }
10 | }
11 | }
12 | },
13 | "2011101": {
14 | "EntryId": 2011101,
15 | "GroupList": {
16 | "21":{
17 | "GroupId": 21,
18 | "PropState": {
19 | "300004": "Unlocked"
20 | }
21 | }
22 | }
23 | },
24 | "2012101": {
25 | "EntryId": 2012101,
26 | "GroupList": {
27 | "3":{
28 | "GroupId": 3,
29 | "PropState": {
30 | "300005": "Elevator2"
31 | }
32 | }
33 | }
34 | },
35 | "2012301": {
36 | "EntryId": 2012301,
37 | "GroupList": {
38 | "8":{
39 | "GroupId": 8,
40 | "PropState": {
41 | "300001": "Elevator2",
42 | "300011": "Unlocked"
43 | }
44 | }
45 | }
46 | },
47 | "2013101": {
48 | "EntryId": 2013101,
49 | "GroupList": {
50 | "6":{
51 | "GroupId": 6,
52 | "PropState": {
53 | "300010": "Unlocked"
54 | }
55 | }
56 | }
57 | },
58 | "2013201": {
59 | "EntryId": 2013201,
60 | "GroupList": {
61 | "3":{
62 | "GroupId": 3,
63 | "PropState": {
64 | "300013": "Open"
65 | }
66 | },
67 | "4":{
68 | "GroupId": 4,
69 | "PropState": {
70 | "300003": "Open"
71 | }
72 | }
73 | }
74 | },
75 | "2023101": {
76 | "EntryId": 2023101,
77 | "GroupList": {
78 | "54":{
79 | "GroupId": 54,
80 | "PropState": {
81 | "300004": "Closed"
82 | }
83 | }
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/data/TextMap/TextMapCHT.json:
--------------------------------------------------------------------------------
1 | {
2 | "0": "語言檔案讀取測試",
3 | "1": "伺服器版本:%s",
4 | "2": "遊戲版本:%s",
5 | "3": "hkrpg-go-pe正在關閉",
6 | "4": "hkrpg-go-pe已停止",
7 | "5": "取消埋點回報",
8 | "6": "連接埋點回報伺服器失败:%s",
9 | "7": "埋點回報伺服器錯誤",
10 | "8": "連接埋點回報伺服器成功",
11 | "9": "未知的埋點類型:%s",
12 | "10": "Ec2b不存在,生成新的Ec2b檔案",
13 | "11": "讀取Ec2b檔案失敗:%s",
14 | "12": "解析Ec2b檔案失敗:%s",
15 | "13": "Ec2b初始化成功",
16 | "14": "讀取資源檔案",
17 | "15": "讀取全部資源完成,耗時:%v秒",
18 | "16": "未找到資源資料夾:%s",
19 | "17": "讀取了%v個設定,檔案:%s",
20 | "18": "讀取%s檔案失敗,原因:%s",
21 | "19": "解析%s檔案失敗,原因:%s",
22 | "20": "未知的卡池類型:%s",
23 | "21": "基礎卡池載入錯誤,將導致無法抽取常駐角色",
24 | "22": "未知的Ability:%s",
25 | "23": "不存在Dimension,取消載入此場景planeId:%v floorId%v",
26 | "24": "未找到有效的fool,將不載入場景",
27 | "25": "未找到有效的fool,將不載入傳送",
28 | "26": "不存在的場景設定,取消載入此場景傳送planeId:%v floorId%v",
29 | "27": "沒有找到指令,請輸入/help查詢可用指令",
30 | "28": "伺服器內部錯誤,請附上截圖並聯繫管理員解決",
31 | "29": "歡迎使用hkrpg-go"
32 | }
--------------------------------------------------------------------------------
/data/TextMap/TextMapEN.json:
--------------------------------------------------------------------------------
1 | {
2 | "0": "Testing for loading language file",
3 | "1": "Server version :%s",
4 | "2": "Game version :%s",
5 | "3": "Shutting down hkrpg-go-pe...",
6 | "4": "hkrpg-go-pe has been shutdown",
7 | "5": "Cancal Operation Platform Data Upload",
8 | "6": "Failed connecting to Operation Platform Data Upload Server: %s",
9 | "7": "Operation Platform Data Upload Server returned an error",
10 | "8": "Operation Platform Data Upload Server has been connected",
11 | "9": "Unknown operation data type: %s",
12 | "10": "Ec2b does not exist, generating a new Ec2b file",
13 | "11": "Failed to load Ec2b file: %s",
14 | "12": "Failed to parse Ec2b file: %s",
15 | "13": "Ec2b file has been initialized",
16 | "14": "Loading resources files",
17 | "15": "Finished loading resources files, Time spent: %vs",
18 | "16": "Did not find resources folder: %s",
19 | "17": "Loaded %v settings, File: %s",
20 | "18": "Failed to load %s, Reason: %s",
21 | "19": "Failed to parse %s, Reason: %s",
22 | "20": "Invalid banner type: %s",
23 | "21": "Error occured while loading Standard banner info, will not be able to pull for standard banner's characters",
24 | "22": "Unknown Ability: %s",
25 | "23": "Dimension does not exist, loading of this scene has been cancelled. planeId:%v floorId%v",
26 | "24": "Did not find valid fool, will not load this scene",
27 | "25": "Did not find valid fool, will not teleport to this scene",
28 | "26": "Scene config does not exist, teleports on this scene will not be loaded. planeId:%v floorId%v",
29 | "27": "Invalid command! Please enter /help to check for available commands",
30 | "28": "Server internal error, please provide screenshot to admin to resolve this issue",
31 | "29": "Welcome to hkrpg-go"
32 | }
--------------------------------------------------------------------------------
/dbconf/init.go:
--------------------------------------------------------------------------------
1 | package dbconf
2 |
3 | import (
4 | "gorm.io/gorm"
5 | )
6 |
7 | func GameServer(dsn *gorm.DB) {
8 | NewAllMail(dsn) // 全服邮件
9 | NewRogue(dsn) // 模拟宇宙排期
10 | }
11 |
--------------------------------------------------------------------------------
/dbconf/mail.go:
--------------------------------------------------------------------------------
1 | package dbconf
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/pkg/constant"
5 | "github.com/gucooing/hkrpg-go/pkg/database"
6 | "github.com/gucooing/hkrpg-go/pkg/logger"
7 | "github.com/hjson/hjson-go/v4"
8 | "gorm.io/gorm"
9 | )
10 |
11 | var MAIL *Mail
12 |
13 | type Mail struct {
14 | AllMailMap map[uint32]*constant.Mail
15 | }
16 |
17 | func GetMail() *Mail {
18 | if MAIL == nil {
19 | MAIL = &Mail{
20 | AllMailMap: make(map[uint32]*constant.Mail),
21 | }
22 | }
23 | return MAIL
24 | }
25 |
26 | // 拉取全服邮件
27 | func NewAllMail(dsn *gorm.DB) {
28 | m := GetMail()
29 | db := database.GetDbAllMail(dsn)
30 | m.AllMailMap = make(map[uint32]*constant.Mail)
31 | for _, v := range db {
32 | mail := v
33 | mail.ItemList = make([]*constant.Item, 0)
34 | if v.Item != "" {
35 | err := hjson.Unmarshal([]byte(v.Item), &mail.ItemList)
36 | if err != nil {
37 | logger.Error("mail item error: %v", err)
38 | }
39 | }
40 | m.AllMailMap[v.Id] = mail
41 | }
42 | }
43 |
44 | func GetAllMail() map[uint32]*constant.Mail {
45 | return GetMail().AllMailMap
46 | }
47 |
48 | func GetAllMailById(id uint32) *constant.Mail {
49 | if db := GetMail().AllMailMap; db == nil {
50 | return nil
51 | } else {
52 | return db[id]
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/dbconf/rogue.go:
--------------------------------------------------------------------------------
1 | package dbconf
2 |
3 | import (
4 | "sort"
5 | "time"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/constant"
8 | "github.com/gucooing/hkrpg-go/pkg/database"
9 | "github.com/gucooing/hkrpg-go/pkg/logger"
10 | "gorm.io/gorm"
11 | )
12 |
13 | var ROGUE *Rogue
14 |
15 | type Rogue struct {
16 | RogueMap map[uint32]*constant.RogueConf
17 | }
18 |
19 | func GetRogue() *Rogue {
20 | if ROGUE == nil {
21 | ROGUE = &Rogue{
22 | RogueMap: make(map[uint32]*constant.RogueConf),
23 | }
24 | }
25 | return ROGUE
26 | }
27 |
28 | func NewRogue(dsn *gorm.DB) {
29 | r := GetRogue()
30 | db := database.GetAllRogue(dsn)
31 | if IsOverlapping(db) {
32 | logger.Error("Rogue Time Overlapping")
33 | panic("Rogue Time Overlapping")
34 | }
35 | for _, v := range db {
36 | r.RogueMap[v.SeasonId] = v
37 | }
38 | }
39 |
40 | type TimeInterval struct {
41 | start time.Time
42 | end time.Time
43 | }
44 |
45 | func IsOverlapping(rogueMap []*constant.RogueConf) bool {
46 | var timeIntervals []TimeInterval
47 | for _, rc := range rogueMap {
48 | timeIntervals = append(timeIntervals, TimeInterval{start: rc.BeginTime.Time, end: rc.EndTime.Time})
49 | }
50 | sort.Slice(timeIntervals, func(i, j int) bool {
51 | return timeIntervals[i].start.Before(timeIntervals[j].start)
52 | })
53 | overlapping := false
54 | for i := 1; i < len(timeIntervals); i++ {
55 | if !timeIntervals[i].start.After(timeIntervals[i-1].end) {
56 | overlapping = true
57 | break
58 | }
59 | }
60 | return overlapping
61 | }
62 |
63 | func GetCurRogue() *constant.RogueConf {
64 | currentTime := time.Now()
65 | for _, v := range GetRogue().RogueMap {
66 | if currentTime.After(v.BeginTime.Time) && currentTime.Before(v.EndTime.Time) {
67 | return v
68 | }
69 | }
70 | return nil
71 | }
72 |
--------------------------------------------------------------------------------
/dispatch/sdk/api.go:
--------------------------------------------------------------------------------
1 | package sdk
2 |
3 | import (
4 | "io/ioutil"
5 | "net/http"
6 |
7 | "github.com/gin-gonic/gin"
8 | "github.com/gucooing/hkrpg-go/pkg/constant"
9 | "github.com/gucooing/hkrpg-go/pkg/database"
10 | "github.com/gucooing/hkrpg-go/pkg/logger"
11 | )
12 |
13 | func (s *Server) getComboToken(c *gin.Context) {
14 | accountId := c.Query("account_id")
15 | rsp := &constant.GateGetPlayerComboToken{
16 | Retcode: 0,
17 | AccountId: accountId,
18 | ComboToken: "",
19 | }
20 | token := database.GetComboTokenByAccountId(database.DISPATCH.LoginRedis, database.DISPATCH.AccountMysql, accountId)
21 | if token == "" {
22 | rsp.Retcode = -1
23 | } else {
24 | rsp.ComboToken = token
25 | }
26 | c.JSON(http.StatusOK, rsp)
27 | }
28 |
29 | func (s *Server) GetExperimentListHandler(c *gin.Context) {
30 | c.Header("Content-type", "application/json")
31 | _, _ = c.Writer.WriteString("{\"retcode\":0,\"success\":true,\"message\":\"\",\"data\":[{\"code\":1000,\"type\":2,\"config_id\":\"14\",\"period_id\":\"6125_197\",\"version\":\"1\",\"configs\":{\"cardType\":\"direct\"}}]}")
32 | }
33 |
34 | func (s *Server) SdkDataUploadHandler(c *gin.Context) {
35 | c.JSON(200, gin.H{
36 | "code": 0,
37 | })
38 | }
39 |
40 | func (s *Server) apmdataUpload(c *gin.Context) {
41 | req := c.Request
42 | body, err := ioutil.ReadAll(req.Body)
43 | if err != nil {
44 | return
45 | }
46 | logger.Debug("/apm/dataUpload", string(body))
47 | c.JSON(200, gin.H{
48 | "code": 0,
49 | })
50 | }
51 |
52 | func (s *Server) RiskyApiCheckHandler(c *gin.Context) {
53 | c.String(200, "{\"retcode\":0,\"message\":\"OK\",\"data\":{\"id\":\"none\",\"action\":\"ACTION_NONE\",\"geetest\":null}}")
54 | }
55 |
--------------------------------------------------------------------------------
/dispatch/sdk/common.go:
--------------------------------------------------------------------------------
1 | package sdk
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | )
6 |
7 | func (s *Server) ExchangeCdkey(c *gin.Context) {
8 | c.Header("Content-type", "application/json")
9 | c.String(200, "{\"retcode\":0,\"message\":\"OK\",\"data\":{\"msg\":\"兑换成功\"}}")
10 | }
11 |
12 | func (s *Server) commonh5log(c *gin.Context) {
13 | c.String(200, "{\"retcode\":0,\"message\":\"success\",\"data\":null}")
14 | }
15 |
--------------------------------------------------------------------------------
/docker/hkrpg-go/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM golang:1.23-alpine as builder
2 | LABEL authors="gucooing"
3 |
4 | WORKDIR /usr/hkrpg
5 | ADD go.mod .
6 | ADD go.sum .
7 | RUN go mod download && go mod verify
8 | COPY . .
9 | RUN go build -tags netgo -o /usr/hkrpg/hkrpg-go ./cmd/hkrpg-go/hkrpg-go.go
10 |
11 | FROM alpine:latest
12 | RUN apk add --no-cache git bash
13 | WORKDIR /usr/hkrpg
14 | COPY --from=builder /usr/hkrpg/hkrpg-go /usr/hkrpg/hkrpg-go
15 | COPY --from=builder /usr/hkrpg/data/ /usr/hkrpg/data/
16 | COPY --from=builder /usr/hkrpg/start.sh /usr/hkrpg/start.sh
17 | RUN chmod +x /usr/hkrpg/start.sh
18 | EXPOSE 8080/tcp 20041/udp
19 | ENTRYPOINT ["bash","start.sh"]
--------------------------------------------------------------------------------
/docs/rebirth/EN.md:
--------------------------------------------------------------------------------
1 |
20 |
21 | REBIRTH Official Server Archive Import Guide
22 |
23 | Supported import content:
24 |
25 | [√]Backpack
26 |
27 | [√]Team
28 |
29 | [√]Character
30 |
31 | Supported content:
32 |
33 | [*]Mail
34 |
35 | [*]Story
36 |
37 | Import steps:
38 |
39 | [√]hkrpg-go: Already supported
40 |
41 | [*]LunarCore: To be supported
42 |
43 | [*]DanhengServer: To be supported
44 |
45 | Note: Please follow the specific import guide for private servers
--------------------------------------------------------------------------------
/docs/rebirth/FR.md:
--------------------------------------------------------------------------------
1 |
20 | Guide d'importation des archives du serveur officiel REBIRTH
21 |
22 | Prise en charge du contenu importé :
23 |
24 | [√]Sac à dos
25 |
26 | [√]Formation
27 |
28 | [√]Rôle
29 |
30 | Ce qui sera bientôt pris en charge :
31 |
32 | [*]mail
33 |
34 | [*]Parcelle
35 |
36 | Étapes d'importation :
37 |
38 | [√]hkrpg-go : pris en charge
39 |
40 | [*]LunarCore : à prendre en charge
41 |
42 | [*]DanhengServer : à prendre en charge
43 |
44 | REMARQUE : Veuillez suivre le guide d'importation spécifique à votre serveur privé.
--------------------------------------------------------------------------------
/docs/rebirth/JP.md:
--------------------------------------------------------------------------------
1 |
20 |
21 | REBIRTH公式サーバーアーカイブインポートガイド
22 |
23 | インポートされたコンテンツのサポート:
24 |
25 | [√]バックパック
26 |
27 | [√]フォーメーション
28 |
29 | [√]役割
30 |
31 | 近日公開:
32 |
33 | [*]郵便
34 |
35 | [*]プロット
36 |
37 | インポート手順:
38 |
39 | [√]hkrpg-go:対応
40 |
41 | [*]LunarCore: サポート予定
42 |
43 | [*]DanhengServer: サポート予定
44 |
45 | 注: プライベート サーバー固有のインポート ガイドに従ってください。
--------------------------------------------------------------------------------
/docs/rebirth/KR.md:
--------------------------------------------------------------------------------
1 |
20 |
21 | REBIRTH 공식 서버 아카이브 가져오기 안내
22 |
23 | 가져온 콘텐츠 지원:
24 |
25 | [√]백팩
26 |
27 | [√]형성
28 |
29 | [√]역할
30 |
31 | 곧 지원될 내용:
32 |
33 | [*]우편
34 |
35 | [*]구성
36 |
37 | 가져오기 단계:
38 |
39 | [√]hkrpg-go: 지원됨
40 |
41 | [*]LunarCore: 지원 예정
42 |
43 | [*]DanhengServer: 지원 예정
44 |
45 | 참고: 개인 서버에 대한 특정 가져오기 가이드를 따르십시오.
--------------------------------------------------------------------------------
/docs/rebirth/RU.md:
--------------------------------------------------------------------------------
1 |
20 |
21 | Руководство по импорту официального архива сервера REBIRTH
22 |
23 | Поддержка импортированного контента:
24 |
25 | [√]Рюкзак
26 |
27 | [√]Формирование
28 |
29 | [√]Роль
30 |
31 | Вскоре:
32 |
33 | [*]почта
34 |
35 | [*]Сюжет
36 |
37 | Шаги импорта:
38 |
39 | [√]hkrpg-go: Поддерживается
40 |
41 | [*]LunarCore: Будет поддерживаться
42 |
43 | [*]DanhengServer: будет поддерживаться
44 |
45 | ПРИМЕЧАНИЕ. Следуйте конкретному руководству по импорту для вашего частного сервера.
--------------------------------------------------------------------------------
/docs/rebirth/VI.md:
--------------------------------------------------------------------------------
1 |
20 |
21 | Hướng dẫn nhập kho lưu trữ máy chủ chính thức REBIRTH
22 |
23 | Hỗ trợ nội dung đã nhập:
24 |
25 | [√]Ba lô
26 |
27 | [√]Đội hình
28 |
29 | [√]Vai trò
30 |
31 | Sắp ra mắt:
32 |
33 | [*]thư
34 |
35 | [*]Kịch bản
36 |
37 | Các bước nhập khẩu:
38 |
39 | [√]hkrpg-go: Được hỗ trợ
40 |
41 | [*]LunarCore: Được hỗ trợ
42 |
43 | [*]DanhengServer: Được hỗ trợ
44 |
45 | LƯU Ý: Vui lòng làm theo hướng dẫn nhập cụ thể cho máy chủ riêng của bạn
--------------------------------------------------------------------------------
/docs/rebirth/zh-CN.md:
--------------------------------------------------------------------------------
1 |
20 |
21 | REBIRTH 官服存档导入指南
22 |
23 | 支持导入内容:
24 |
25 | [√]背包
26 |
27 | [√]编队
28 |
29 | [√]角色
30 |
31 | 即将支持内容:
32 |
33 | [*]邮件
34 |
35 | [*]剧情
36 |
37 | 导入步骤:
38 |
39 | [√]hkrpg-go: 已支持
40 |
41 | [*]LunarCore: 待支持
42 |
43 | [*]DanhengServer: 待支持
44 |
45 | 注意: 请按照私人服务器的具体导入指南操作
46 |
--------------------------------------------------------------------------------
/docs/rebirth/zh-TW.md:
--------------------------------------------------------------------------------
1 |
20 |
21 | REBIRTH 官服存檔導入指南
22 |
23 | 支援導入內容:
24 |
25 | [√]背包
26 |
27 | [√]編隊
28 |
29 | [√]角色
30 |
31 | 即將支援內容:
32 |
33 | [*]郵件
34 |
35 | [*]劇情
36 |
37 | 導入步驟:
38 |
39 | [√]hkrpg-go: 已支持
40 |
41 | [*]LunarCore: 待支持
42 |
43 | [*]DanhengServer: 待支持
44 |
45 | 注意: 請依照私人伺服器的特定匯入指南操作
--------------------------------------------------------------------------------
/docs/差分宇宙地图解析.ini:
--------------------------------------------------------------------------------
1 | 一:
2 | 战斗 冒险/奖励/事件 战斗/事件 首领
3 | 战斗 战斗/奖励/事件 遭遇/事件 首领
4 | 二:
5 | 战斗/商店/事件 战斗/事件 战斗/冒险/事件 冒险/奖励/财富 首领
6 | 战斗/商店/事件 战斗/事件 战斗/冒险/事件 战斗/事件 首领
7 | 三:
8 | 战斗/商店/财富 战斗/冒险/商店 休整 首领
9 | 战斗/商店/事件 战斗/奖励/事件 休整 首领
10 | 遭遇/商店/事件 战斗/奖励/事件 休整 首领
11 |
12 | 首领 1
13 | 精英 2
14 | 战斗 3
15 | 遭遇 4
16 | 事件 5
17 | 财富 6
18 | 商店 7
19 | 奖励 8
20 | 冒险 9
21 | 休整 10
22 | Reforge 11
23 | 奇遇 12
--------------------------------------------------------------------------------
/docs/模拟宇宙场景选择原理.ini:
--------------------------------------------------------------------------------
1 | 101:战 精 休 战 事 休 首 1
2 | 201:战 精 休 战 精 休 战 休 首 2
3 | 300:战 精 休 战 精 休 事 休 首 3
4 | 405:战 精 休 战 精 休 战 休 首 4
5 | 504:战 精 休 战 精 休 事 休 首 5
6 | 604:战 精 休 战 精 休 战 休 首 6
7 | 704:战 精 休 战 精 休 交 休 首 7
8 | 804:战 精 休 战 精 休 战 休 首 8
9 | 904:战 精 休 战 精 休 战 休 首 9
10 |
11 | area 100:100
12 |
13 | type
14 | 1:战
15 | 2:战
16 | 3:事
17 | 4:遭
18 | 5:休
19 | 6:精
20 | 7:首
21 | 8:交
22 | 9:冒
23 |
24 | 1:战1 战1
25 | 2: 精
26 | 3: 休
27 | 4:精 战
28 | 5:休 事
29 | 6:战1 休
30 | 7: 首
31 | 8:精
32 | 9:休
33 | 10:事 战2
34 | 12:休
35 | 13:首
36 | 21:战2
37 | 22:事
38 | 31:战2
39 | 32:事
40 | 71:事 遭
41 | 72:战2 遭
42 | 111:战2 事
43 | 112:遭 交
--------------------------------------------------------------------------------
/gameserver/model/db_activity.go:
--------------------------------------------------------------------------------
1 | package model
2 |
3 | import (
4 | spb "github.com/gucooing/hkrpg-go/protocol/server/proto"
5 | )
6 |
7 | func NewActivity() *spb.Activity {
8 | return &spb.Activity{
9 | TrialActivity: &spb.TrialActivity{},
10 | ActivityLogin: make(map[uint32]uint32),
11 | }
12 | }
13 |
14 | func (g *PlayerData) GetActivity() *spb.Activity {
15 | db := g.GetBasicBin()
16 | if db.Activity == nil {
17 | db.Activity = NewActivity()
18 | }
19 | return db.Activity
20 | }
21 |
22 | func (g *PlayerData) GetLoginActivity() map[uint32]uint32 {
23 | if g.GetActivity().ActivityLogin == nil {
24 | g.GetActivity().ActivityLogin = make(map[uint32]uint32)
25 | }
26 | return g.GetActivity().ActivityLogin
27 | }
28 |
--------------------------------------------------------------------------------
/gameserver/model/db_activity_clock_park.go:
--------------------------------------------------------------------------------
1 | package model
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/gdconf"
5 | "github.com/gucooing/hkrpg-go/protocol/proto"
6 | )
7 |
8 | /*****************************接口***************************/
9 |
10 | func (g *PlayerData) GetClockParkInfoList() []*proto.ClockParkInfo {
11 | list := make([]*proto.ClockParkInfo, 0)
12 | for _, conf := range gdconf.GetClockParkScriptConfigMap() {
13 | if g.GetUnlockStatus(conf.ScriptUnlockCondition) {
14 | list = append(list, &proto.ClockParkInfo{
15 | ScriptId: conf.ActivityStudioScriptID,
16 | ChapterIds: []uint32{conf.StartChapterID},
17 | })
18 | }
19 | }
20 |
21 | return list
22 | }
23 |
--------------------------------------------------------------------------------
/gameserver/model/db_activity_music_rhythm.go:
--------------------------------------------------------------------------------
1 | package model
2 |
3 | /*****************************接口***************************/
4 |
5 | // func (g *PlayerData) GetMusicRhythmLevelList() []*proto.MusicRhythmLevel {
6 | // list := make([]*proto.MusicRhythmLevel, 0)
7 | //
8 | // return list
9 | // }
10 |
--------------------------------------------------------------------------------
/gameserver/player/player_activity_clock_park.go:
--------------------------------------------------------------------------------
1 | package player
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/protocol/cmd"
5 | "github.com/gucooing/hkrpg-go/protocol/proto"
6 | pb "google.golang.org/protobuf/proto"
7 | )
8 |
9 | func ClockParkGetInfoCsReq(g *GamePlayer, payloadMsg pb.Message) {
10 | rsp := &proto.ClockParkGetInfoScRsp{
11 | ParkInfos: g.GetPd().GetClockParkInfoList(),
12 | Retcode: 0,
13 | Progress: 0,
14 | }
15 | g.Send(cmd.ClockParkGetInfoScRsp, rsp)
16 | }
17 |
18 | func ClockParkStartScriptCsReq(g *GamePlayer, payloadMsg pb.Message) {
19 | req := payloadMsg.(*proto.ClockParkStartScriptCsReq)
20 | rsp := &proto.ClockParkStartScriptScRsp{
21 | Retcode: 0,
22 | ScriptId: req.ScriptId,
23 | }
24 | g.Send(cmd.ClockParkStartScriptScRsp, rsp)
25 | }
26 |
27 | func ClockParkGetOngoingScriptInfoCsReq(g *GamePlayer, payloadMsg pb.Message) {
28 | rsp := &proto.ClockParkGetOngoingScriptInfoScRsp{
29 | ScriptId: 1,
30 | Retcode: 0,
31 | }
32 | g.Send(cmd.ClockParkGetOngoingScriptInfoScRsp, rsp)
33 | }
34 |
--------------------------------------------------------------------------------
/gameserver/player/player_activity_music_rhythm.go:
--------------------------------------------------------------------------------
1 | package player
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/protocol/cmd"
5 | "github.com/gucooing/hkrpg-go/protocol/proto"
6 | pb "google.golang.org/protobuf/proto"
7 | )
8 |
9 | func MusicRhythmDataCsReq(g *GamePlayer, payloadMsg pb.Message) {
10 | rsp := &proto.MusicRhythmDataScRsp{
11 | Retcode: 0,
12 | // MusicLevel: g.GetPd().GetMusicRhythmLevelList(),
13 | // UnlockPhaseList: nil,
14 | // CurLevelId: 0,
15 | // CurSongId: 0,
16 | // MusicGroup: nil,
17 | // ShowHint: false,
18 | // UnlockSongList: nil,
19 | // UnlockTrackList: nil,
20 | }
21 | g.Send(cmd.MusicRhythmDataScRsp, rsp)
22 | }
23 |
--------------------------------------------------------------------------------
/gameserver/player/player_activity_sword_training.go:
--------------------------------------------------------------------------------
1 | package player
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/protocol/cmd"
5 | "github.com/gucooing/hkrpg-go/protocol/proto"
6 | pb "google.golang.org/protobuf/proto"
7 | )
8 |
9 | func GetSwordTrainingDataCsReq(g *GamePlayer, payloadMsg pb.Message) {
10 | rsp := &proto.GetSwordTrainingDataScRsp{}
11 | g.Send(cmd.GetSwordTrainingDataScRsp, rsp)
12 | }
13 |
14 | func SwordTrainingStartGameCsReq(g *GamePlayer, payloadMsg pb.Message) {
15 | // req := payloadMsg.(*proto.SwordTrainingStartGameCsReq)
16 | g.SwordTrainingGameSyncChangeScNotify()
17 | rsp := &proto.SwordTrainingStartGameScRsp{}
18 | g.Send(cmd.SwordTrainingStartGameScRsp, rsp)
19 | }
20 |
21 | func (g *GamePlayer) SwordTrainingGameSyncChangeScNotify() {
22 | notify := &proto.SwordTrainingGameSyncChangeScNotify{}
23 | g.Send(cmd.SwordTrainingGameSyncChangeScNotify, notify)
24 | }
25 |
--------------------------------------------------------------------------------
/gameserver/player/player_change_story.go:
--------------------------------------------------------------------------------
1 | package player
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/gdconf"
5 | "github.com/gucooing/hkrpg-go/protocol/cmd"
6 | "github.com/gucooing/hkrpg-go/protocol/proto"
7 | )
8 |
9 | func (g *GamePlayer) StoryLineInfoScNotify() {
10 | notify := &proto.StoryLineInfoScNotify{
11 | CurStoryLineId: 0,
12 | TrialAvatarIdList: make([]uint32, 0),
13 | UnfinishedStoryLineIdList: []uint32{0},
14 | }
15 |
16 | if db := g.GetPd().GetCurChangeStoryInfo(); db != nil {
17 | conf := gdconf.GetStroyLineTrialAvatarData(db.ChangeStoryId)
18 | if conf != nil {
19 | notify.CurStoryLineId = db.ChangeStoryId
20 | notify.TrialAvatarIdList = conf.TrialAvatarList
21 | }
22 | }
23 |
24 | for _, changeStory := range g.GetPd().GetAllChangeStoryInfo() {
25 | notify.UnfinishedStoryLineIdList = append(notify.UnfinishedStoryLineIdList,
26 | changeStory.ChangeStoryId)
27 | }
28 |
29 | g.Send(cmd.StoryLineInfoScNotify, notify)
30 | }
31 |
32 | func (g *GamePlayer) ChangeStoryLineFinishScNotify() {
33 | notify := &proto.ChangeStoryLineFinishScNotify{
34 | CurStoryLineId: 0,
35 | Action: 0,
36 | }
37 | if db := g.GetPd().GetCurChangeStoryInfo(); db != nil {
38 | notify.CurStoryLineId = db.ChangeStoryId
39 | notify.Action = proto.ChangeStoryLineAction_ChangeStoryLineAction_Client
40 | } else {
41 | return
42 | }
43 | g.Send(cmd.ChangeStoryLineFinishScNotify, notify)
44 | }
45 |
--------------------------------------------------------------------------------
/gameserver/player/player_query.go:
--------------------------------------------------------------------------------
1 | package player
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/protocol/cmd"
5 | "github.com/gucooing/hkrpg-go/protocol/proto"
6 | spb "github.com/gucooing/hkrpg-go/protocol/server/proto"
7 | pb "google.golang.org/protobuf/proto"
8 | )
9 |
10 | func SceneEntityMoveCsReq(g *GamePlayer, payloadMsg pb.Message) {
11 | req := payloadMsg.(*proto.SceneEntityMoveCsReq)
12 | if g.GetPd().IsChangeStory() {
13 | } else if g.GetPd().GetBattleStatus() == spb.BattleType_Battle_RAID {
14 | } else if g.GetPd().GetBattleStatus() == spb.BattleType_Battle_NONE {
15 | entityList := g.GetPd().GetEntity(0)
16 | if entityList == nil {
17 | g.Send(cmd.SceneEntityMoveScRsp, &proto.SceneEntityMoveScRsp{})
18 | return
19 | }
20 | for _, entry := range req.EntityMotionList {
21 | if entityList[entry.EntityId] != nil {
22 | g.GetPd().SetPos(entry.Motion.Pos.X, entry.Motion.Pos.Y, entry.Motion.Pos.Z)
23 | g.GetPd().SetRot(entry.Motion.Rot.X, entry.Motion.Rot.Y, entry.Motion.Rot.Z)
24 | break
25 | }
26 | }
27 | }
28 |
29 | g.Send(cmd.SceneEntityMoveScRsp, &proto.SceneEntityMoveScRsp{})
30 | }
31 |
--------------------------------------------------------------------------------
/gameserver/player/player_quest.go:
--------------------------------------------------------------------------------
1 | package player
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/gdconf"
5 | "github.com/gucooing/hkrpg-go/protocol/cmd"
6 | "github.com/gucooing/hkrpg-go/protocol/proto"
7 | pb "google.golang.org/protobuf/proto"
8 | )
9 |
10 | func GetQuestDataCsReq(g *GamePlayer, payloadMsg pb.Message) {
11 | rsp := new(proto.GetQuestDataScRsp)
12 | rsp.QuestList = make([]*proto.Quest, 0)
13 | for _, questInfo := range gdconf.GetQuestDataMap() {
14 | status := proto.QuestStatus_QUEST_DOING
15 | var progress uint32 = 0
16 | if g.GetPd().GetIsJumpMission() {
17 | status = proto.QuestStatus_QUEST_CLOSE
18 | progress = 1
19 | }
20 | quest := &proto.Quest{
21 | Progress: progress,
22 | Status: status,
23 | Id: questInfo.QuestID,
24 | FinishTime: 1699688465,
25 | }
26 | rsp.QuestList = append(rsp.QuestList, quest)
27 | }
28 |
29 | g.Send(cmd.GetQuestDataScRsp, rsp)
30 | }
31 |
--------------------------------------------------------------------------------
/gateserver/service/server_msg.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/pkg/mq"
5 | smd "github.com/gucooing/hkrpg-go/protocol/server"
6 | spb "github.com/gucooing/hkrpg-go/protocol/server/proto"
7 | pb "google.golang.org/protobuf/proto"
8 | )
9 |
10 | type HandlerFunc func(g *GateServer, payloadMsg pb.Message)
11 |
12 | var handlerFuncRouteMap map[uint16]HandlerFunc
13 |
14 | func init() {
15 | handlerFuncRouteMap = map[uint16]HandlerFunc{
16 | smd.PlayerLogoutReq: playerLogoutReq,
17 | }
18 | }
19 |
20 | func playerLogoutReq(g *GateServer, payloadMsg pb.Message) {
21 | req := payloadMsg.(*spb.PlayerLogoutReq)
22 | rsp := &spb.PlayerLogoutRsp{
23 | Uid: req.Uid,
24 | GateAppId: req.GateAppId,
25 | Status: req.Status,
26 | }
27 | s := g.GetSession(req.Uid)
28 | if s != nil {
29 | PlayerLogoutCsReq(g, s, nil)
30 | }
31 | g.MessageQueue.SendToNode(&mq.NetMsg{
32 | MsgType: mq.ServerMsg,
33 | Uid: req.Uid,
34 | CmdId: smd.PlayerLogoutRsp,
35 | ServiceMsgPb: rsp,
36 | })
37 | }
38 |
--------------------------------------------------------------------------------
/gateserver/session/conn.go:
--------------------------------------------------------------------------------
1 | package session
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/pkg/constant"
5 | )
6 |
7 | var CLIENT_CONN_NUM int64 = 0 // 当前客户端连接数
8 | var MAX_CLIENT__CONN_NUM int64 = -1 // 最大客户端连接数
9 | var QPS int64
10 |
11 | type ListenerAll interface {
12 | initListener() error
13 | GetListener() *Listener
14 | Run() error
15 | Close()
16 | }
17 |
18 | type Listener struct {
19 | netInfo constant.AppNet
20 | LoginSessionChan chan SessionAll // 添加登录会话
21 | DelLoginSessionChan chan SessionAll // 删除登录会话
22 | }
23 |
24 | func NewListener(netInfo constant.AppNet, gateTcp bool) (ListenerAll, error) {
25 | var allL ListenerAll
26 | l := &Listener{
27 | netInfo: netInfo,
28 | LoginSessionChan: make(chan SessionAll, 100),
29 | DelLoginSessionChan: make(chan SessionAll, 100),
30 | }
31 | if gateTcp {
32 | allL = &TcpListener{
33 | Listener: l,
34 | }
35 | } else {
36 | allL = &KcpListener{
37 | Listener: l,
38 | }
39 | }
40 | if err := allL.initListener(); err != nil {
41 | return nil, err
42 | }
43 | return allL, nil
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/gdconf/activity_login_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type ActivityLoginConfig struct {
13 | ID uint32 `json:"ID"`
14 | RewardList []uint32 `json:"RewardList"`
15 | ActivityModuleID uint32 `json:"ActivityModuleID"`
16 | }
17 |
18 | func (g *GameDataConfig) loadActivityLoginConfig() {
19 | g.ActivityLoginConfigMap = make(map[uint32]*ActivityLoginConfig)
20 | activityLoginConfigMap := make([]*ActivityLoginConfig, 0)
21 | name := "ActivityLoginConfig.json"
22 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &activityLoginConfigMap)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 | for _, v := range activityLoginConfigMap {
32 | g.ActivityLoginConfigMap[v.ID] = v
33 | }
34 | logger.Info(text.GetText(17), len(g.ActivityLoginConfigMap), name)
35 | }
36 |
37 | func GetActivityLoginConfigById(id uint32) *ActivityLoginConfig {
38 | return getConf().ActivityLoginConfigMap[id]
39 | }
40 |
41 | func GetActivityLoginListById() []uint32 {
42 | var activityLoginList []uint32
43 | for _, conf := range getConf().ActivityLoginConfigMap {
44 | activityLoginList = append(activityLoginList, conf.ID)
45 | }
46 | return activityLoginList
47 | }
48 |
--------------------------------------------------------------------------------
/gdconf/activity_panel.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type ActivityPanel struct {
13 | PanelID uint32 `json:"PanelID"`
14 | Type uint32 `json:"Type"`
15 | ActivityModuleID uint32 `json:"ActivityModuleID"`
16 | UnlockConditions string `json:"UnlockConditions"` // 解锁条件
17 | }
18 |
19 | type UnlockConditions struct {
20 | Type string `json:"Type"`
21 | Param string `json:"Param"`
22 | }
23 |
24 | func (g *GameDataConfig) loadActivityPanel() {
25 | g.ActivityPanelMap = make(map[uint32]*ActivityPanel)
26 | activityPanelMap := make([]*ActivityPanel, 0)
27 | name := "ActivityPanel.json"
28 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(18), name, err))
31 | }
32 |
33 | err = hjson.Unmarshal(playerElementsFile, &activityPanelMap)
34 | if err != nil {
35 | panic(fmt.Sprintf(text.GetText(19), name, err))
36 | }
37 | for _, v := range activityPanelMap {
38 | g.ActivityPanelMap[v.ActivityModuleID] = v
39 | }
40 | logger.Info(text.GetText(17), len(g.ActivityPanelMap), name)
41 | }
42 |
43 | func GetActivityPanelById(ID uint32) *ActivityPanel {
44 | return getConf().ActivityPanelMap[ID]
45 | }
46 |
47 | func GetActivityPanelMap() map[uint32]*ActivityPanel {
48 | return getConf().ActivityPanelMap
49 | }
50 |
51 | func GetActivityPanelList() []uint32 {
52 | var activityList []uint32
53 | for _, activity := range getConf().ActivityPanelMap {
54 | activityList = append(activityList, activity.PanelID)
55 | }
56 | return activityList
57 | }
58 |
--------------------------------------------------------------------------------
/gdconf/activity_scheduling.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type ActivityScheduling struct {
13 | ActivityId uint32 `json:"activityId"`
14 | BeginTime int64 `json:"beginTime"`
15 | EndTime int64 `json:"endTime"`
16 | ModuleId uint32 `json:"moduleId"`
17 | }
18 |
19 | func (g *GameDataConfig) loadActivityScheduling() {
20 | g.ActivitySchedulingMap = make([]*ActivityScheduling, 0)
21 | name := "ActivityScheduling.json"
22 | playerElementsFile, err := os.ReadFile(g.dataPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &g.ActivitySchedulingMap)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 |
32 | logger.Info(text.GetText(17), len(g.ActivitySchedulingMap), name)
33 | }
34 |
35 | func GetActivitySchedulingMap() []*ActivityScheduling {
36 | return getConf().ActivitySchedulingMap
37 | }
38 |
--------------------------------------------------------------------------------
/gdconf/adventure_player.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type AdventurePlayer struct {
13 | ID uint32 `json:"ID"`
14 | AvatarID uint32 `json:"AvatarID"`
15 | MazeSkillIdList []uint32 `json:"MazeSkillIdList"`
16 | }
17 |
18 | func (g *GameDataConfig) loadAdventurePlayer() {
19 | g.AdventurePlayerMap = make(map[uint32]*AdventurePlayer)
20 | adventurePlayerMap := make([]*AdventurePlayer, 0)
21 | name := "AdventurePlayer.json"
22 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &adventurePlayerMap)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 | for _, v := range adventurePlayerMap {
32 | g.AdventurePlayerMap[v.ID] = v
33 | }
34 | logger.Info(text.GetText(17), len(g.AdventurePlayerMap), name)
35 | }
36 |
37 | func GetAdventurePlayerByAvatarId(id uint32) *AdventurePlayer {
38 | return getConf().AdventurePlayerMap[id]
39 | }
40 |
--------------------------------------------------------------------------------
/gdconf/aether_divide_challenge_list.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type AetherDivideChallengeList struct {
13 | ID uint32 `json:"ID"`
14 | ChallengeType string `json:"ChallengeType"`
15 | GroupID uint32 `json:"GroupID"`
16 | BattleAreaID uint32 `json:"BattleAreaID"`
17 | Rank uint32 `json:"Rank"`
18 | RewardID uint32 `json:"RewardID"`
19 | EventID uint32 `json:"EventID"`
20 | }
21 |
22 | func (g *GameDataConfig) loadAetherDivideChallengeList() {
23 | g.AetherDivideChallengeListMap = make(map[uint32]*AetherDivideChallengeList)
24 | aetherDivideChallengeListList := make([]*AetherDivideChallengeList, 0)
25 | name := "AetherDivideChallengeList.json"
26 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
27 | if err != nil {
28 | panic(fmt.Sprintf(text.GetText(18), name, err))
29 | }
30 |
31 | err = hjson.Unmarshal(playerElementsFile, &aetherDivideChallengeListList)
32 | if err != nil {
33 | panic(fmt.Sprintf(text.GetText(19), name, err))
34 | }
35 | for _, v := range aetherDivideChallengeListList {
36 | g.AetherDivideChallengeListMap[v.ID] = v
37 | }
38 | logger.Info(text.GetText(17), len(g.AetherDivideChallengeListMap), name)
39 | }
40 |
41 | func GetAetherDivideChallengeList(id uint32) *AetherDivideChallengeList {
42 | return getConf().AetherDivideChallengeListMap[id]
43 | }
44 |
--------------------------------------------------------------------------------
/gdconf/aether_divide_passive_skill.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type AetherDividePassiveSkill struct {
13 | ItemID uint32 `json:"ItemID"`
14 | Rarity uint32 `json:"Rarity"`
15 | }
16 |
17 | func (g *GameDataConfig) loadAetherDividePassiveSkill() {
18 | g.AetherDividePassiveSkillMap = make(map[uint32]*AetherDividePassiveSkill)
19 | aetherDividePassiveSkillList := make([]*AetherDividePassiveSkill, 0)
20 | name := "AetherDividePassiveSkill.json"
21 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
22 | if err != nil {
23 | panic(fmt.Sprintf(text.GetText(18), name, err))
24 | }
25 |
26 | err = hjson.Unmarshal(playerElementsFile, &aetherDividePassiveSkillList)
27 | if err != nil {
28 | panic(fmt.Sprintf(text.GetText(19), name, err))
29 | }
30 | for _, v := range aetherDividePassiveSkillList {
31 | g.AetherDividePassiveSkillMap[v.ItemID] = v
32 | }
33 | logger.Info(text.GetText(17), len(g.AetherDividePassiveSkillMap), name)
34 | }
35 |
36 | func GetAetherDividePassiveSkillMap() map[uint32]*AetherDividePassiveSkill {
37 | return getConf().AetherDividePassiveSkillMap
38 | }
39 |
--------------------------------------------------------------------------------
/gdconf/aether_divide_spirit.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type AetherDivideSpirit struct {
13 | AvatarID uint32 `json:"AvatarID"`
14 | Rarity string `json:"Rarity"`
15 | SPMax *Value `json:"SPMax"`
16 | GymLocation uint32 `json:"GymLocation"`
17 | MaxPromotion uint32 `json:"MaxPromotion"`
18 | SkillList []uint32 `json:"SkillList"`
19 | PassiveSkillSlotList []string `json:"PassiveSkillSlotList"`
20 | ExpItemID uint32 `json:"ExpItemID"`
21 | AvatarVOTag string `json:"AvatarVOTag"`
22 | DamageType string `json:"DamageType"`
23 | RecommendPassiveSkillList []uint32 `json:"RecommendPassiveSkillList"`
24 | }
25 |
26 | func (g *GameDataConfig) loadAetherDivideSpirit() {
27 | g.AetherDivideSpiritMap = make(map[uint32]*AetherDivideSpirit)
28 | aetherDivideSpiritList := make([]*AetherDivideSpirit, 0)
29 | name := "AetherDivideSpirit.json"
30 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
31 | if err != nil {
32 | panic(fmt.Sprintf(text.GetText(18), name, err))
33 | }
34 |
35 | err = hjson.Unmarshal(playerElementsFile, &aetherDivideSpiritList)
36 | if err != nil {
37 | panic(fmt.Sprintf(text.GetText(19), name, err))
38 | }
39 | for _, v := range aetherDivideSpiritList {
40 | g.AetherDivideSpiritMap[v.AvatarID] = v
41 | }
42 | logger.Info(text.GetText(17), len(g.AetherDivideSpiritMap), name)
43 | }
44 |
45 | func GetAetherDivideSpiritMap() map[uint32]*AetherDivideSpirit {
46 | return getConf().AetherDivideSpiritMap
47 | }
48 |
49 | func GetAetherDivideSpirit(id uint32) *AetherDivideSpirit {
50 | return getConf().AetherDivideSpiritMap[id]
51 | }
52 |
--------------------------------------------------------------------------------
/gdconf/aether_divide_spirit_trial.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type AetherDivideSpiritTrial struct {
13 | ID uint32 `json:"ID"`
14 | SpiritID uint32 `json:"SpiritID"`
15 | Promotion uint32 `json:"Promotion"`
16 | }
17 |
18 | func (g *GameDataConfig) loadAetherDivideSpiritTrial() {
19 | g.AetherDivideSpiritTrialMap = make(map[uint32]*AetherDivideSpiritTrial)
20 | aetherDivideSpiritTrialList := make([]*AetherDivideSpiritTrial, 0)
21 | name := "AetherDivideSpiritTrial.json"
22 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &aetherDivideSpiritTrialList)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 | for _, v := range aetherDivideSpiritTrialList {
32 | g.AetherDivideSpiritTrialMap[v.ID] = v
33 | }
34 | logger.Info(text.GetText(17), len(g.AetherDivideSpiritTrialMap), name)
35 | }
36 |
37 | func GetAetherDivideSpiritTrial(id uint32) *AetherDivideSpiritTrial {
38 | return getConf().AetherDivideSpiritTrialMap[id]
39 | }
40 |
--------------------------------------------------------------------------------
/gdconf/avatar_demo_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type AvatarDemoConfig struct {
13 | StageID uint32 `json:"StageID"`
14 | AvatarID uint32 `json:"AvatarID"`
15 | TrialAvatarList []uint32 `json:"TrialAvatarList"`
16 | RewardID uint32 `json:"RewardID"`
17 | RaidID uint32 `json:"RaidID"`
18 | ScoringGroupID uint32 `json:"ScoringGroupID"`
19 | GuideGroupID uint32 `json:"GuideGroupID"`
20 | PlaneID uint32 `json:"PlaneID"`
21 | FloorID uint32 `json:"FloorID"`
22 | BattleAreaGroupID uint32 `json:"BattleAreaGroupID"`
23 | BattleAreaID uint32 `json:"BattleAreaID"`
24 | MapEntranceID uint32 `json:"MapEntranceID"`
25 | MazeGroupID1 uint32 `json:"MazeGroupID1"`
26 | ConfigList1 []uint32 `json:"ConfigList1"`
27 | NpcMonsterIDList1 []uint32 `json:"NpcMonsterIDList1"`
28 | EventIDList1 []uint32 `json:"EventIDList1"`
29 | }
30 |
31 | func (g *GameDataConfig) loadAvatarDemoConfig() {
32 | g.AvatarDemoConfigMap = make(map[uint32]*AvatarDemoConfig)
33 | avatarDemoConfigMap := make([]*AvatarDemoConfig, 0)
34 | name := "AvatarDemoConfig.json"
35 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
36 | if err != nil {
37 | panic(fmt.Sprintf(text.GetText(18), name, err))
38 | }
39 |
40 | err = hjson.Unmarshal(playerElementsFile, &avatarDemoConfigMap)
41 | if err != nil {
42 | panic(fmt.Sprintf(text.GetText(19), name, err))
43 | }
44 | for _, v := range avatarDemoConfigMap {
45 | g.AvatarDemoConfigMap[v.StageID] = v
46 | }
47 | logger.Info(text.GetText(17), len(g.AvatarDemoConfigMap), name)
48 | }
49 |
50 | func GetAvatarDemoConfigById(stageID uint32) *AvatarDemoConfig {
51 | return getConf().AvatarDemoConfigMap[stageID]
52 | }
53 |
--------------------------------------------------------------------------------
/gdconf/avatar_expItem_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type AvatarExpItemConfig struct {
13 | ItemID uint32 `json:"ItemID"`
14 | Exp uint32 `json:"Exp"`
15 | }
16 |
17 | func (g *GameDataConfig) loadAvatarExpItemConfig() {
18 | g.AvatarExpItemConfigMap = make(map[uint32]*AvatarExpItemConfig)
19 | avatarExpItemConfigMap := make([]*AvatarExpItemConfig, 0)
20 | name := "AvatarExpItemConfig.json"
21 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
22 | if err != nil {
23 | panic(fmt.Sprintf(text.GetText(18), name, err))
24 | }
25 |
26 | err = hjson.Unmarshal(playerElementsFile, &avatarExpItemConfigMap)
27 | if err != nil {
28 | panic(fmt.Sprintf(text.GetText(19), name, err))
29 | }
30 | for _, v := range avatarExpItemConfigMap {
31 | g.AvatarExpItemConfigMap[v.ItemID] = v
32 | }
33 | logger.Info(text.GetText(17), len(g.AvatarExpItemConfigMap), name)
34 | }
35 |
36 | func GetAvatarExpItemConfigById(itemID uint32) *AvatarExpItemConfig {
37 | return getConf().AvatarExpItemConfigMap[itemID]
38 | }
39 |
40 | func GetAvatarExpItemConfigMap() map[uint32]*AvatarExpItemConfig {
41 | return getConf().AvatarExpItemConfigMap
42 | }
43 |
--------------------------------------------------------------------------------
/gdconf/avatar_player_icon.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type AvatarPlayerIcon struct {
13 | ID uint32 `json:"ID"`
14 | AvatarID uint32 `json:"AvatarID"`
15 | }
16 |
17 | func (g *GameDataConfig) loadAvatarPlayerIcon() {
18 | g.AvatarPlayerIconMap = make(map[uint32]*AvatarPlayerIcon)
19 | avatarPlayerIconList := make([]*AvatarPlayerIcon, 0)
20 | name := "AvatarPlayerIcon.json"
21 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
22 | if err != nil {
23 | panic(fmt.Sprintf(text.GetText(18), name, err))
24 | }
25 |
26 | err = hjson.Unmarshal(playerElementsFile, &avatarPlayerIconList)
27 | if err != nil {
28 | panic(fmt.Sprintf(text.GetText(19), name, err))
29 | }
30 | for _, v := range avatarPlayerIconList {
31 | g.AvatarPlayerIconMap[v.AvatarID] = v
32 | }
33 | logger.Info(text.GetText(17), len(g.AvatarPlayerIconMap), name)
34 | }
35 |
36 | func GetAvatarPlayerIcon(avatarID uint32) *AvatarPlayerIcon {
37 | return getConf().AvatarPlayerIconMap[avatarID]
38 | }
39 |
--------------------------------------------------------------------------------
/gdconf/back_ground_music.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type BackGroundMusic struct {
13 | ID uint32 `json:"ID"`
14 | GroupID uint32 `json:"GroupID"`
15 | MusicSwitchName string `json:"MusicSwitchName"`
16 | BPM uint32 `json:"BPM"`
17 | Unlock bool `json:"Unlock"`
18 | }
19 |
20 | func (g *GameDataConfig) loadBackGroundMusic() {
21 | g.BackGroundMusicMap = make(map[uint32]*BackGroundMusic)
22 | backGroundMusicMap := make([]*BackGroundMusic, 0)
23 | name := "BackGroundMusic.json"
24 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
25 | if err != nil {
26 | panic(fmt.Sprintf(text.GetText(18), name, err))
27 | }
28 |
29 | err = hjson.Unmarshal(playerElementsFile, &backGroundMusicMap)
30 | if err != nil {
31 | panic(fmt.Sprintf(text.GetText(19), name, err))
32 | }
33 | for _, v := range backGroundMusicMap {
34 | g.BackGroundMusicMap[v.ID] = v
35 | }
36 | logger.Info(text.GetText(17), len(g.BackGroundMusicMap), name)
37 | }
38 |
39 | func GetBackGroundMusicById(iD uint32) *BackGroundMusic {
40 | return getConf().BackGroundMusicMap[iD]
41 | }
42 |
43 | func GetBackGroundMusicMap() map[uint32]*BackGroundMusic {
44 | return getConf().BackGroundMusicMap
45 | }
46 |
--------------------------------------------------------------------------------
/gdconf/callenge_group_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type ChallengeGroupConfig struct {
13 | GroupID uint32 `json:"GroupID"`
14 | RewardLineGroupID uint32 `json:"RewardLineGroupID"`
15 | PreMissionID uint32 `json:"PreMissionID"`
16 | ScheduleDataID uint32 `json:"ScheduleDataID"`
17 | MazeBuffID uint32 `json:"MazeBuffID"`
18 | }
19 |
20 | func (g *GameDataConfig) loadChallengeGroupConfig() {
21 | g.ChallengeGroupConfigMap = make(map[uint32]*ChallengeGroupConfig)
22 |
23 | fileList := []string{"ChallengeGroupConfig.json", "ChallengeStoryGroupConfig.json",
24 | "ChallengeBossGroupConfig.json"}
25 | for _, file := range fileList {
26 | challengeConfigList := make([]*ChallengeGroupConfig, 0)
27 | files := g.excelPrefix + file
28 | bin, err := os.ReadFile(files)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(18), file, err))
31 | }
32 | err = hjson.Unmarshal(bin, &challengeConfigList)
33 | if err != nil {
34 | panic(fmt.Sprintf(text.GetText(19), file, err))
35 | }
36 | for _, v := range challengeConfigList {
37 | g.ChallengeGroupConfigMap[v.GroupID] = v
38 | }
39 | }
40 |
41 | logger.Info(text.GetText(17), len(g.ChallengeGroupConfigMap), "ChallengeGroupConfig")
42 | }
43 |
44 | func GetChallengeGroupConfig(guid uint32) *ChallengeGroupConfig {
45 | return getConf().ChallengeGroupConfigMap[guid]
46 | }
47 |
--------------------------------------------------------------------------------
/gdconf/challenge_reward_line.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type ChallengeRewardLine struct {
13 | GroupID uint32 `json:"GroupID"`
14 | StarCount uint32 `json:"StarCount"`
15 | RewardID uint32 `json:"RewardID"`
16 | }
17 |
18 | func (g *GameDataConfig) loadChallengeRewardLine() {
19 | g.ChallengeRewardLineMap = make(map[uint32]map[uint32]*ChallengeRewardLine, 0)
20 |
21 | fileList := []string{"ChallengeMazeRewardLine.json", "ChallengeStoryRewardLine.json",
22 | "ChallengeBossRewardLine.json"}
23 | for _, file := range fileList {
24 | challengeConfigList := make([]*ChallengeRewardLine, 0)
25 | files := g.excelPrefix + file
26 | bin, err := os.ReadFile(files)
27 | if err != nil {
28 | panic(fmt.Sprintf(text.GetText(18), file, err))
29 | }
30 | err = hjson.Unmarshal(bin, &challengeConfigList)
31 | if err != nil {
32 | panic(fmt.Sprintf(text.GetText(19), file, err))
33 | }
34 | for _, v := range challengeConfigList {
35 | if g.ChallengeRewardLineMap[v.GroupID] == nil {
36 | g.ChallengeRewardLineMap[v.GroupID] = make(map[uint32]*ChallengeRewardLine)
37 | }
38 | g.ChallengeRewardLineMap[v.GroupID][v.StarCount] = v
39 | }
40 | }
41 |
42 | logger.Info(text.GetText(17), len(g.ChallengeRewardLineMap), "ChallengeRewardLineMap")
43 | }
44 |
45 | func GetChallengeRewardLineRewardID(guid uint32, star uint32) uint32 {
46 | if getConf().ChallengeRewardLineMap[guid] == nil {
47 | return 0
48 | }
49 | if getConf().ChallengeRewardLineMap[guid][star] == nil {
50 | return 0
51 | }
52 | return getConf().ChallengeRewardLineMap[guid][star].RewardID
53 | }
54 |
--------------------------------------------------------------------------------
/gdconf/challenge_story_maze_extra.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type ChallengeStoryMazeExtra struct {
13 | ID uint32 `json:"ID"`
14 | TurnLimit uint32 `json:"TurnLimit"` // 回合限制
15 | BattleTargetID []uint32 `json:"BattleTargetID"`
16 | ClearScore uint32 `json:"ClearScore"`
17 | }
18 |
19 | func (g *GameDataConfig) loadChallengeStoryMazeExtra() {
20 | g.ChallengeStoryMazeExtraMap = make(map[uint32]*ChallengeStoryMazeExtra, 0)
21 | challengeStoryMazeExtraMap := make([]*ChallengeStoryMazeExtra, 0)
22 | name := "ChallengeStoryMazeExtra.json"
23 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
24 | if err != nil {
25 | panic(fmt.Sprintf(text.GetText(18), name, err))
26 | }
27 |
28 | err = hjson.Unmarshal(playerElementsFile, &challengeStoryMazeExtraMap)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(19), name, err))
31 | }
32 |
33 | for _, v := range challengeStoryMazeExtraMap {
34 | g.ChallengeStoryMazeExtraMap[v.ID] = v
35 | }
36 |
37 | logger.Info(text.GetText(17), len(g.ChallengeStoryMazeExtraMap), name)
38 | }
39 |
40 | func GetChallengeStoryMazeExtraById(id uint32) *ChallengeStoryMazeExtra {
41 | return getConf().ChallengeStoryMazeExtraMap[id]
42 | }
43 |
--------------------------------------------------------------------------------
/gdconf/challenge_target_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type ChallengeTargetConfig struct {
13 | ID uint32 `json:"ID"`
14 | ChallengeTargetType string `json:"ChallengeTargetType"`
15 | ChallengeTargetParam1 uint32 `json:"ChallengeTargetParam1"`
16 | RewardID uint32 `json:"RewardID"`
17 | }
18 |
19 | func (g *GameDataConfig) loadChallengeTargetConfig() {
20 | g.ChallengeTargetConfigMap = make(map[uint32]*ChallengeTargetConfig)
21 | fileList := []string{"ChallengeTargetConfig.json", "ChallengeStoryTargetConfig.json",
22 | "ChallengeBossTargetConfig.json"}
23 | for _, file := range fileList {
24 | challengeConfigList := make([]*ChallengeTargetConfig, 0)
25 | files := g.excelPrefix + file
26 | bin, err := os.ReadFile(files)
27 | if err != nil {
28 | panic(fmt.Sprintf(text.GetText(18), file, err))
29 | }
30 | err = hjson.Unmarshal(bin, &challengeConfigList)
31 | if err != nil {
32 | panic(fmt.Sprintf(text.GetText(19), file, err))
33 | }
34 | for _, v := range challengeConfigList {
35 | g.ChallengeTargetConfigMap[v.ID] = v
36 | }
37 | }
38 |
39 | logger.Info(text.GetText(17), len(g.ChallengeTargetConfigMap), "ChallengeTargetConfig")
40 | }
41 |
42 | func GetChallengeTargetConfigById(id uint32) *ChallengeTargetConfig {
43 | return getConf().ChallengeTargetConfigMap[id]
44 | }
45 |
--------------------------------------------------------------------------------
/gdconf/chat_bubble_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type ChatBubbleConfig struct {
13 | ID uint32 `json:"ID"`
14 | ShowType string `json:"ShowType"`
15 | ShowParam uint32 `json:"ShowParam"`
16 | }
17 |
18 | func (g *GameDataConfig) loadChatBubbleConfig() {
19 | g.ChatBubbleConfigMap = make(map[uint32]*ChatBubbleConfig)
20 | chatBubbleConfigList := make([]*ChatBubbleConfig, 0)
21 | name := "ChatBubbleConfig.json"
22 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &chatBubbleConfigList)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 |
32 | for _, v := range chatBubbleConfigList {
33 | g.ChatBubbleConfigMap[v.ID] = v
34 | }
35 |
36 | logger.Info(text.GetText(17), len(g.ChatBubbleConfigMap), name)
37 | }
38 |
39 | func GetChatBubbleConfigMap() map[uint32]*ChatBubbleConfig {
40 | return getConf().ChatBubbleConfigMap
41 | }
42 |
--------------------------------------------------------------------------------
/gdconf/city_shop_reward_list.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type CityShopRewardList struct {
13 | GroupID uint32 `json:"GroupID"`
14 | Level uint32 `json:"Level"`
15 | RewardID uint32 `json:"RewardID"`
16 | ItemNeed uint32 `json:"ItemNeed"`
17 | TotalItem uint32 `json:"TotalItem"`
18 | }
19 |
20 | func (g *GameDataConfig) loadCityShopRewardList() {
21 | g.CityShopRewardListMap = make(map[uint32]map[uint32]*CityShopRewardList)
22 | cityShopRewardList := make([]*CityShopRewardList, 0)
23 | name := "CityShopRewardList.json"
24 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
25 | if err != nil {
26 | panic(fmt.Sprintf(text.GetText(18), name, err))
27 | }
28 |
29 | err = hjson.Unmarshal(playerElementsFile, &cityShopRewardList)
30 | if err != nil {
31 | panic(fmt.Sprintf(text.GetText(19), name, err))
32 | }
33 |
34 | for _, v := range cityShopRewardList {
35 | if g.CityShopRewardListMap[v.GroupID] == nil {
36 | g.CityShopRewardListMap[v.GroupID] = make(map[uint32]*CityShopRewardList)
37 | }
38 | g.CityShopRewardListMap[v.GroupID][v.Level] = v
39 | }
40 |
41 | logger.Info(text.GetText(17), len(g.CityShopRewardListMap), name)
42 | }
43 |
44 | func GetCityShopRewardList(shopId uint32) map[uint32]*CityShopRewardList {
45 | return getConf().CityShopRewardListMap[shopId]
46 | }
47 |
48 | func GetCityShopMaxLevel(shopId uint32) uint32 {
49 | return uint32(len(getConf().CityShopRewardListMap[shopId]))
50 | }
51 |
52 | func GetCityShopReward(shopId, level uint32) *CityShopRewardList {
53 | if getConf().CityShopRewardListMap[shopId] == nil {
54 | return nil
55 | }
56 | return getConf().CityShopRewardListMap[shopId][level]
57 | }
58 |
--------------------------------------------------------------------------------
/gdconf/cocoon_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type CocoonConfig struct {
13 | ID uint32 `json:"ID"`
14 | WorldLevel uint32 `json:"WorldLevel"`
15 | PropID uint32 `json:"PropID"`
16 | CocoonType string `json:"CocoonType"`
17 | MappingInfoID uint32 `json:"MappingInfoID"`
18 | StageID uint32 `json:"StageID"`
19 | StageIDList []uint32 `json:"StageIDList"`
20 | ParamList []*Value `json:"ParamList"`
21 | DropList []uint32 `json:"DropList"`
22 | StaminaCost uint32 `json:"StaminaCost"` // 扣除体力
23 | MaxWave uint32 `json:"MaxWave"`
24 | OpenDate []uint32 `json:"OpenDate"`
25 | DamageType []string `json:"DamageType"`
26 | FarmType string `json:"FarmType"`
27 | }
28 |
29 | func (g *GameDataConfig) loadCocoonConfig() {
30 | g.CocoonConfigMap = make(map[uint32]map[uint32]*CocoonConfig)
31 | cocoonConfigMap := make([]*CocoonConfig, 0)
32 | name := "CocoonConfig.json"
33 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
34 | if err != nil {
35 | panic(fmt.Sprintf(text.GetText(18), name, err))
36 | }
37 |
38 | err = hjson.Unmarshal(playerElementsFile, &cocoonConfigMap)
39 | if err != nil {
40 | panic(fmt.Sprintf(text.GetText(19), name, err))
41 | }
42 |
43 | for _, v := range cocoonConfigMap {
44 | if g.CocoonConfigMap[v.ID] == nil {
45 | g.CocoonConfigMap[v.ID] = make(map[uint32]*CocoonConfig)
46 | }
47 | g.CocoonConfigMap[v.ID][v.WorldLevel] = v
48 | }
49 |
50 | logger.Info(text.GetText(17), len(g.CocoonConfigMap), name)
51 | }
52 |
53 | func GetCocoonConfigById(id, worldLevel uint32) *CocoonConfig {
54 | return getConf().CocoonConfigMap[id][worldLevel]
55 | }
56 |
--------------------------------------------------------------------------------
/gdconf/content_package_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type ContentPackageConfig struct {
13 | ContentID uint32 `json:"ContentID"`
14 | MainMissionIDList []uint32 `json:"MainMissionIDList"`
15 | EarlyAccessCondition string `json:"EarlyAccessCondition"`
16 | EarlyFinishCondition string `json:"EarlyFinishCondition"`
17 | ReleaseCondition string `json:"ReleaseCondition"`
18 | InitEntranceID uint32 `json:"InitEntranceID"`
19 | GuideConditions string `json:"GuideConditions"`
20 | AfterGuideEntranceID uint32 `json:"AfterGuideEntranceID"`
21 | }
22 |
23 | func (g *GameDataConfig) loadContentPackageConfig() {
24 | g.ContentPackageConfigMap = make(map[uint32]*ContentPackageConfig)
25 | contentPackageConfigList := make([]*ContentPackageConfig, 0)
26 | name := "ContentPackageConfig.json"
27 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(18), name, err))
30 | }
31 |
32 | err = hjson.Unmarshal(playerElementsFile, &contentPackageConfigList)
33 | if err != nil {
34 | panic(fmt.Sprintf(text.GetText(19), name, err))
35 | }
36 |
37 | for _, v := range contentPackageConfigList {
38 | g.ContentPackageConfigMap[v.ContentID] = v
39 | }
40 |
41 | logger.Info(text.GetText(17), len(g.ContentPackageConfigMap), name)
42 | }
43 |
44 | func GetContentPackageConfigMap() map[uint32]*ContentPackageConfig {
45 | return getConf().ContentPackageConfigMap
46 | }
47 |
--------------------------------------------------------------------------------
/gdconf/daily_mission_data.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type DailyMissionData struct {
13 | ID uint32 `json:"ID"`
14 | DailyMissionType uint8 `json:"DailyMissionType"`
15 | GroupID uint32 `json:"GroupID"`
16 | UnlockMainMission uint32 `json:"UnlockMainMission"`
17 | QuestID uint32 `json:"QuestID"`
18 | }
19 |
20 | func (g *GameDataConfig) loadDailyMissionData() {
21 | g.DailyMissionDataMap = make(map[uint32]*DailyMissionData)
22 | dailyMissionDataList := make([]*DailyMissionData, 0)
23 | name := "DailyMissionData.json"
24 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
25 | if err != nil {
26 | panic(fmt.Sprintf(text.GetText(18), name, err))
27 | }
28 |
29 | err = hjson.Unmarshal(playerElementsFile, &dailyMissionDataList)
30 | if err != nil {
31 | panic(fmt.Sprintf(text.GetText(19), name, err))
32 | }
33 |
34 | for _, v := range dailyMissionDataList {
35 | g.DailyMissionDataMap[v.ID] = v
36 | }
37 |
38 | logger.Info(text.GetText(17), len(g.DailyMissionDataMap), name)
39 | }
40 |
41 | func GetDailyMissionDataMap() map[uint32]*DailyMissionData {
42 | return getConf().DailyMissionDataMap
43 | }
44 |
--------------------------------------------------------------------------------
/gdconf/equipment_skill_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type EquipmentSkillConfig struct {
13 | SkillID uint32 `json:"SkillID"`
14 | Level uint32 `json:"Level"`
15 | AbilityName string `json:"AbilityName"`
16 | ParamList []*Value `json:"ParamList"`
17 | AbilityProperty []*AbilityProperty `json:"AbilityProperty"`
18 | }
19 | type AbilityProperty struct {
20 | PropertyType string `json:"PropertyType"`
21 | Value *Value `json:"Value"`
22 | }
23 |
24 | func (g *GameDataConfig) loadEquipmentSkillConfig() {
25 | g.EquipmentSkillConfigMap = make(map[uint32]map[uint32]*EquipmentSkillConfig)
26 | erquipmentSkillConfig := make([]*EquipmentSkillConfig, 0)
27 | name := "EquipmentSkillConfig.json"
28 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(18), name, err))
31 | }
32 |
33 | err = hjson.Unmarshal(playerElementsFile, &erquipmentSkillConfig)
34 | if err != nil {
35 | panic(fmt.Sprintf(text.GetText(19), name, err))
36 | }
37 | for _, v := range erquipmentSkillConfig {
38 | if g.EquipmentSkillConfigMap[v.SkillID] == nil {
39 | g.EquipmentSkillConfigMap[v.SkillID] = make(map[uint32]*EquipmentSkillConfig)
40 | }
41 | g.EquipmentSkillConfigMap[v.SkillID][v.Level] = v
42 | }
43 |
44 | logger.Info(text.GetText(17), len(g.EquipmentSkillConfigMap), name)
45 | }
46 |
47 | func GetEquipmentSkillConfig(id, rank uint32) *EquipmentSkillConfig {
48 | if getConf().EquipmentSkillConfigMap[id] == nil {
49 | return nil
50 | }
51 | return getConf().EquipmentSkillConfigMap[id][rank]
52 | }
53 |
--------------------------------------------------------------------------------
/gdconf/event_mission.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type EventMission struct {
13 | ID uint32 `json:"ID"`
14 | Type string `json:"Type"`
15 | NextEventMissionList []uint32 `json:"NextEventMissionList"`
16 | TakeType string `json:"TakeType"`
17 | TakeParamIntList []uint32 `json:"TakeParamIntList"`
18 | FinishWayID uint32 `json:"FinishWayID"`
19 | MazePlaneID uint32 `json:"MazePlaneID"`
20 | MazeFloorID uint32 `json:"MazeFloorID"`
21 | LoadGroupList []uint32 `json:"LoadGroupList"`
22 | UnLoadGroupList []uint32 `json:"UnLoadGroupList"`
23 | ClearGroupList []uint32 `json:"ClearGroupList"`
24 | MissionJsonPath string `json:"MissionJsonPath"`
25 | RewardID uint32 `json:"RewardID"`
26 | }
27 |
28 | func (g *GameDataConfig) loadEventMission() {
29 | g.EventMissionMap = make(map[uint32]*EventMission)
30 | eventMissionMap := make([]*EventMission, 0)
31 | name := "EventMission.json"
32 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
33 | if err != nil {
34 | panic(fmt.Sprintf(text.GetText(18), name, err))
35 | }
36 |
37 | err = hjson.Unmarshal(playerElementsFile, &eventMissionMap)
38 | if err != nil {
39 | panic(fmt.Sprintf(text.GetText(19), name, err))
40 | }
41 | for _, v := range eventMissionMap {
42 | g.EventMissionMap[v.ID] = v
43 | }
44 |
45 | logger.Info(text.GetText(17), len(g.EventMissionMap), name)
46 | }
47 |
48 | func GetEventMission() map[uint32]*EventMission {
49 | return getConf().EventMissionMap
50 | }
51 |
--------------------------------------------------------------------------------
/gdconf/exp_type.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type ExpType struct {
13 | TypeID uint32 `json:"TypeID"`
14 | Level uint32 `json:"Level"`
15 | Exp uint32 `json:"Exp"`
16 | }
17 |
18 | func (g *GameDataConfig) loadExpType() {
19 | g.ExpTypeMap = make(map[uint32]map[uint32]*ExpType)
20 | expTypeMap := make([]*ExpType, 0)
21 | name := "ExpType.json"
22 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &expTypeMap)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 | for _, v := range expTypeMap {
32 | if g.ExpTypeMap[v.TypeID] == nil {
33 | g.ExpTypeMap[v.TypeID] = make(map[uint32]*ExpType)
34 | }
35 | g.ExpTypeMap[v.TypeID][v.Level] = v
36 | }
37 |
38 | logger.Info(text.GetText(17), len(g.ExpTypeMap), name)
39 | }
40 |
41 | func GetExpTypeByLevel(expType, exp, level, promotion, avatarId uint32) (uint32, uint32, uint32) {
42 | maxLevel := GetAvatarMaxLevel(avatarId, promotion)
43 | for ; level <= maxLevel; level++ {
44 | if exp < getConf().ExpTypeMap[expType][level].Exp {
45 | return level, exp, 0
46 | } else {
47 | exp -= getConf().ExpTypeMap[expType][level].Exp
48 | }
49 | }
50 | newExp := getConf().ExpTypeMap[expType][maxLevel].Exp
51 | return maxLevel, newExp, exp - newExp
52 | }
53 |
--------------------------------------------------------------------------------
/gdconf/func_unlock_data.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/constant"
8 | "github.com/gucooing/hkrpg-go/pkg/logger"
9 | "github.com/gucooing/hkrpg-go/pkg/text"
10 | "github.com/hjson/hjson-go/v4"
11 | )
12 |
13 | type FuncUnlockData struct {
14 | UnlockID uint32 `json:"UnlockID"`
15 | Conditions []*ConditionParam `json:"Conditions"`
16 | ShowCondition []*constant.EntranceShowType `json:"ShowCondition"`
17 | }
18 |
19 | type ConditionParam struct {
20 | Type constant.ConditionType `json:"Type"`
21 | Param string `json:"Param"`
22 | }
23 |
24 | func (g *GameDataConfig) loadFuncUnlockData() {
25 | g.FuncUnlockDataMap = make(map[uint32]*FuncUnlockData)
26 | funcUnlockDataList := make([]*FuncUnlockData, 0)
27 | name := "FuncUnlockData.json"
28 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(18), name, err))
31 | }
32 |
33 | err = hjson.Unmarshal(playerElementsFile, &funcUnlockDataList)
34 | if err != nil {
35 | panic(fmt.Sprintf(text.GetText(19), name, err))
36 | }
37 | for _, v := range funcUnlockDataList {
38 | g.FuncUnlockDataMap[v.UnlockID] = v
39 | }
40 |
41 | logger.Info(text.GetText(17), len(g.FuncUnlockDataMap), name)
42 | }
43 |
44 | func GetFuncUnlockData(unlockID uint32) *FuncUnlockData {
45 | return getConf().FuncUnlockDataMap[unlockID]
46 | }
47 |
48 | func GetFuncUnlockDataConditions(unlockID uint32) []*ConditionParam {
49 | conf := GetFuncUnlockData(unlockID)
50 | if conf == nil {
51 | return nil
52 | }
53 | return conf.Conditions
54 | }
55 |
--------------------------------------------------------------------------------
/gdconf/group_system_unlock_data.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type GroupSystemUnlockData struct {
13 | GroupSystemUnlockID uint32 `json:"groupSystemUnlockID"`
14 | UnlockID uint32 `json:"UnlockID"`
15 | }
16 |
17 | func (g *GameDataConfig) loadGroupSystemUnlockData() {
18 | g.GroupSystemUnlockDataMap = make(map[uint32]*GroupSystemUnlockData)
19 | groupSystemUnlockDataList := make([]*GroupSystemUnlockData, 0)
20 | name := "GroupSystemUnlockData.json"
21 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
22 | if err != nil {
23 | panic(fmt.Sprintf(text.GetText(18), name, err))
24 | }
25 |
26 | err = hjson.Unmarshal(playerElementsFile, &groupSystemUnlockDataList)
27 | if err != nil {
28 | panic(fmt.Sprintf(text.GetText(19), name, err))
29 | }
30 | for _, v := range groupSystemUnlockDataList {
31 | g.GroupSystemUnlockDataMap[v.GroupSystemUnlockID] = v
32 | }
33 |
34 | logger.Info(text.GetText(17), len(g.GroupSystemUnlockDataMap), name)
35 | }
36 |
37 | func GetGroupSystemUnlockData(groupSystemUnlockID uint32) *GroupSystemUnlockData {
38 | return getConf().GroupSystemUnlockDataMap[groupSystemUnlockID]
39 | }
40 |
--------------------------------------------------------------------------------
/gdconf/interact_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type InteractConfig struct {
13 | InteractID uint32 `json:"InteractID"`
14 | SrcState string `json:"SrcState"`
15 | TargetState string `json:"TargetState"`
16 | IsEvent bool `json:"IsEvent"`
17 | // ItemCostList []uint32 `json:"ItemCostList"`
18 | }
19 |
20 | func (g *GameDataConfig) loadInteractConfig() {
21 | g.InteractConfigMap = make(map[uint32]*InteractConfig)
22 | interactConfigMap := make([]*InteractConfig, 0)
23 | name := "InteractConfig.json"
24 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
25 | if err != nil {
26 | panic(fmt.Sprintf(text.GetText(18), name, err))
27 | }
28 |
29 | err = hjson.Unmarshal(playerElementsFile, &interactConfigMap)
30 | if err != nil {
31 | panic(fmt.Sprintf(text.GetText(19), name, err))
32 | }
33 | for _, v := range interactConfigMap {
34 | g.InteractConfigMap[v.InteractID] = v
35 | }
36 |
37 | logger.Info(text.GetText(17), len(g.InteractConfigMap), name)
38 | }
39 |
40 | func GetInteractConfigMap() map[uint32]*InteractConfig {
41 | return getConf().InteractConfigMap
42 | }
43 |
44 | func GetInteractConfigById(id uint32) *InteractConfig {
45 | return getConf().InteractConfigMap[id]
46 | }
47 |
--------------------------------------------------------------------------------
/gdconf/item_use_data.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type ItemUseData struct {
13 | UseDataID uint32 `json:"UseDataID"`
14 | UseParam []uint32 `json:"UseParam"`
15 | UseMultipleMax int `json:"UseMultipleMax"`
16 | IsAutoUse bool `json:"IsAutoUse"`
17 | }
18 |
19 | func (g *GameDataConfig) loadItemUseData() {
20 | g.ItemUseDataMap = make(map[uint32]*ItemUseData)
21 | itemUseDataList := make([]*ItemUseData, 0)
22 | name := "ItemUseData.json"
23 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
24 | if err != nil {
25 | panic(fmt.Sprintf(text.GetText(18), name, err))
26 | }
27 |
28 | err = hjson.Unmarshal(playerElementsFile, &itemUseDataList)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(19), name, err))
31 | }
32 | for _, v := range itemUseDataList {
33 | g.ItemUseDataMap[v.UseDataID] = v
34 | }
35 |
36 | logger.Info(text.GetText(17), len(g.ItemUseDataMap), name)
37 | }
38 |
39 | func GetItemUseData(useDataID uint32) *ItemUseData {
40 | return getConf().ItemUseDataMap[useDataID]
41 | }
42 |
--------------------------------------------------------------------------------
/gdconf/loading_desc.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "math/rand"
6 | "os"
7 |
8 | "github.com/gucooing/hkrpg-go/pkg/logger"
9 | "github.com/gucooing/hkrpg-go/pkg/text"
10 | "github.com/hjson/hjson-go/v4"
11 | )
12 |
13 | type LoadingDesc struct {
14 | ID uint32 `json:"ID"` // 随机种子
15 | MinLevel uint32 `json:"MinLevel"` // 最小等级
16 | MaxLevel uint32 `json:"MaxLevel"` // 最大等级
17 | Weight uint32 `json:"Weight"` // 比重(貌似全部都是20)
18 | // TODO 还有部分字段没读,需要再读
19 | }
20 |
21 | func (g *GameDataConfig) loadLoadingDesc() {
22 | g.LoadingDescMap = make(map[uint32]*LoadingDesc)
23 | loadingDescMap := make([]*LoadingDesc, 0)
24 | name := "LoadingDesc.json"
25 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
26 | if err != nil {
27 | panic(fmt.Sprintf(text.GetText(18), name, err))
28 | }
29 |
30 | err = hjson.Unmarshal(playerElementsFile, &loadingDescMap)
31 | if err != nil {
32 | panic(fmt.Sprintf(text.GetText(19), name, err))
33 | }
34 | for _, v := range loadingDescMap {
35 | g.LoadingDescMap[v.ID] = v
36 | }
37 |
38 | logger.Info(text.GetText(17), len(g.LoadingDescMap), name)
39 | }
40 |
41 | func GetLoadingDesc() uint32 {
42 | var list []uint32
43 | idIndex := rand.Intn(len(getConf().LoadingDescMap))
44 | for _, id := range getConf().LoadingDescMap {
45 | list = append(list, id.ID)
46 | }
47 | return list[idIndex]
48 | }
49 |
--------------------------------------------------------------------------------
/gdconf/mapping_info.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type MappingInfo struct {
13 | ID uint32 `json:"ID"`
14 | WorldLevel uint32 `json:"WorldLevel"`
15 | Type string `json:"Type"`
16 | FarmType string `json:"FarmType"`
17 | IsTeleport bool `json:"IsTeleport"`
18 | IsShowInFog bool `json:"IsShowInFog"`
19 | PlaneID uint32 `json:"PlaneID"`
20 | FloorID uint32 `json:"FloorID"`
21 | GroupID uint32 `json:"GroupID"`
22 | ConfigID uint32 `json:"ConfigID"`
23 | ShowMonsterList []uint32 `json:"ShowMonsterList"`
24 | DisplayItemList []*RewardList `json:"DisplayItemList"`
25 | }
26 |
27 | func (g *GameDataConfig) loadMappingInfo() {
28 | g.MappingInfoMap = make(map[uint32]map[uint32]*MappingInfo)
29 | mappingInfoMap := make([]*MappingInfo, 0)
30 | name := "MappingInfo.json"
31 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
32 | if err != nil {
33 | panic(fmt.Sprintf(text.GetText(18), name, err))
34 | }
35 |
36 | err = hjson.Unmarshal(playerElementsFile, &mappingInfoMap)
37 | if err != nil {
38 | panic(fmt.Sprintf(text.GetText(19), name, err))
39 | }
40 |
41 | for _, v := range mappingInfoMap {
42 | if g.MappingInfoMap[v.ID] == nil {
43 | g.MappingInfoMap[v.ID] = make(map[uint32]*MappingInfo)
44 | }
45 | g.MappingInfoMap[v.ID][v.WorldLevel] = v
46 | }
47 |
48 | logger.Info(text.GetText(17), len(g.MappingInfoMap), name)
49 | }
50 |
51 | func GetMappingInfoById(id, worldLevel uint32) *MappingInfo {
52 | return getConf().MappingInfoMap[id][worldLevel]
53 | }
54 |
--------------------------------------------------------------------------------
/gdconf/match_three_bird.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type MatchThreeBird struct {
13 | BirdID uint32 `json:"BirdID"`
14 | UnlockLevel uint32 `json:"UnlockLevel"`
15 | SkillID uint32 `json:"SkillID"`
16 | DefaultEmo uint32 `json:"DefaultEmo"`
17 | WinEmo uint32 `json:"WinEmo"`
18 | DrawEmo uint32 `json:"DrawEmo"`
19 | LoseEmo uint32 `json:"LoseEmo"`
20 | IsShow bool `json:"IsShow"`
21 | GuideID uint32 `json:"GuideID"`
22 | }
23 |
24 | func (g *GameDataConfig) loadMatchThreeBird() {
25 | g.MatchThreeBirdMap = make(map[uint32]*MatchThreeBird)
26 | matchThreeBirdList := make([]*MatchThreeBird, 0)
27 | name := "MatchThreeBird.json"
28 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(18), name, err))
31 | }
32 |
33 | err = hjson.Unmarshal(playerElementsFile, &matchThreeBirdList)
34 | if err != nil {
35 | panic(fmt.Sprintf(text.GetText(19), name, err))
36 | }
37 |
38 | for _, v := range matchThreeBirdList {
39 | g.MatchThreeBirdMap[v.BirdID] = v
40 | }
41 |
42 | logger.Info(text.GetText(17), len(g.MatchThreeBirdMap), name)
43 | }
44 |
45 | func GetMatchThreeBirdMap() map[uint32]*MatchThreeBird {
46 | return getConf().MatchThreeBirdMap
47 | }
48 |
--------------------------------------------------------------------------------
/gdconf/maze_skill.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type MazeSkill struct {
13 | MazeSkillId uint32 `json:"MazeSkillId"`
14 | MazeSkilltype uint32 `json:"MazeSkillType"`
15 | RelatedAvatarSkill uint32 `json:"RelatedAvatarSkill"`
16 | MPCost uint32 `json:"MPCost"`
17 | SkillTriggerKey string `json:"SkillTriggerKey"`
18 | }
19 |
20 | func (g *GameDataConfig) loadMazeSkill() {
21 | g.MazeSkillMap = make(map[uint32]*MazeSkill)
22 | mazeSkillList := make([]*MazeSkill, 0)
23 | name := "MazeSkill.json"
24 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
25 | if err != nil {
26 | panic(fmt.Sprintf(text.GetText(18), name, err))
27 | }
28 |
29 | err = hjson.Unmarshal(playerElementsFile, &mazeSkillList)
30 | if err != nil {
31 | panic(fmt.Sprintf(text.GetText(19), name, err))
32 | }
33 | for _, v := range mazeSkillList {
34 | g.MazeSkillMap[v.MazeSkillId] = v
35 | }
36 |
37 | logger.Info(text.GetText(17), len(g.MazeSkillMap), name)
38 | }
39 |
40 | func GetMazeSkill(mazeSkillId uint32) *MazeSkill {
41 | return getConf().MazeSkillMap[mazeSkillId]
42 | }
43 |
--------------------------------------------------------------------------------
/gdconf/message_section_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type MessageSectionConfig struct {
13 | ID uint32 `json:"ID"`
14 | StartMessageItemIDList []uint32 `json:"StartMessageItemIDList"`
15 | IsPerformMessage bool `json:"IsPerformMessage"`
16 | MainMissionLink uint32 `json:"MainMissionLink"`
17 | }
18 |
19 | func (g *GameDataConfig) loadMessageSectionConfig() {
20 | g.MessageSectionConfigMap = make(map[uint32]*MessageSectionConfig)
21 | messageSectionConfig := make([]*MessageSectionConfig, 0)
22 | name := "MessageSectionConfig.json"
23 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
24 | if err != nil {
25 | panic(fmt.Sprintf(text.GetText(18), name, err))
26 | }
27 |
28 | err = hjson.Unmarshal(playerElementsFile, &messageSectionConfig)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(19), name, err))
31 | }
32 | for _, v := range messageSectionConfig {
33 | g.MessageSectionConfigMap[v.ID] = v
34 | }
35 |
36 | logger.Info(text.GetText(17), len(g.MessageSectionConfigMap), name)
37 | }
38 |
39 | func GetMessageSectionConfig(id uint32) *MessageSectionConfig {
40 | return getConf().MessageSectionConfigMap[id]
41 | }
42 |
--------------------------------------------------------------------------------
/gdconf/monster_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type MonsterConfig struct {
13 | MonsterID uint32 `json:"MonsterID"`
14 | MonsterTemplateID uint32 `json:"MonsterTemplateID"`
15 | HardLevelGroup uint32 `json:"HardLevelGroup"`
16 | EliteGroup uint32 `json:"EliteGroup"`
17 | // TODO 需要再加
18 | }
19 |
20 | func (g *GameDataConfig) loadMonsterConfig() {
21 | g.MonsterConfigMap = make(map[uint32]*MonsterConfig)
22 | monsterConfigMap := make([]*MonsterConfig, 0)
23 | name := "MonsterConfig.json"
24 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
25 | if err != nil {
26 | panic(fmt.Sprintf(text.GetText(18), name, err))
27 | }
28 |
29 | err = hjson.Unmarshal(playerElementsFile, &monsterConfigMap)
30 | if err != nil {
31 | panic(fmt.Sprintf(text.GetText(19), name, err))
32 | }
33 | for _, v := range monsterConfigMap {
34 | g.MonsterConfigMap[v.MonsterID] = v
35 | }
36 |
37 | logger.Info(text.GetText(17), len(g.MonsterConfigMap), name)
38 | }
39 |
40 | func GetMonsterConfigById(monsterID uint32) *MonsterConfig {
41 | return getConf().MonsterConfigMap[monsterID]
42 | }
43 |
44 | func GetMonsterConfigMap() map[uint32]*MonsterConfig {
45 | return getConf().MonsterConfigMap
46 | }
47 |
--------------------------------------------------------------------------------
/gdconf/monster_drop.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type MonsterDrop struct {
13 | MonsterTemplateID uint32 `json:"MonsterTemplateID"`
14 | WorldLevel uint32 `json:"WorldLevel"`
15 | AvatarExpReward uint32 `json:"AvatarExpReward"`
16 | DisplayItemList []*DisplayItemList `json:"DisplayItemList"`
17 | }
18 |
19 | type DisplayItemList struct {
20 | ItemID uint32 `json:"ItemID"`
21 | }
22 |
23 | func (g *GameDataConfig) loadMonsterDrop() {
24 | g.MonsterDropMap = make(map[uint32]map[uint32]*MonsterDrop)
25 | monsterDropList := make([]*MonsterDrop, 0)
26 | name := "MonsterDrop.json"
27 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(18), name, err))
30 | }
31 |
32 | err = hjson.Unmarshal(playerElementsFile, &monsterDropList)
33 | if err != nil {
34 | panic(fmt.Sprintf(text.GetText(19), name, err))
35 | }
36 | for _, v := range monsterDropList {
37 | if g.MonsterDropMap[v.MonsterTemplateID] == nil {
38 | g.MonsterDropMap[v.MonsterTemplateID] = make(map[uint32]*MonsterDrop)
39 | }
40 | g.MonsterDropMap[v.MonsterTemplateID][v.WorldLevel] = v
41 | }
42 |
43 | logger.Info(text.GetText(17), len(g.MonsterDropMap), name)
44 | }
45 |
46 | func GetMonsterDrop(id, worldLevel uint32) *MonsterDrop {
47 | if getConf().MonsterDropMap[id] == nil {
48 | return nil
49 | }
50 | return getConf().MonsterDropMap[id][worldLevel]
51 | }
52 |
--------------------------------------------------------------------------------
/gdconf/multiple_path_avatar_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type MultiplePathAvatarConfig struct {
13 | BaseAvatarID uint32 `json:"BaseAvatarID"` // 角色id
14 | AvatarID uint32 `json:"AvatarID"` // 命途id
15 | UnlockConditions []*UnlockConditions `json:"UnlockConditions"` // 解锁条件
16 | }
17 |
18 | func (g *GameDataConfig) loadMultiplePathAvatarConfig() {
19 | g.MultiplePathAvatarConfigMap = make(map[uint32]*MultiplePathAvatarConfig)
20 | multiplePathAvatarConfigMap := make([]*MultiplePathAvatarConfig, 0)
21 | name := "MultiplePathAvatarConfig.json"
22 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &multiplePathAvatarConfigMap)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 | for _, v := range multiplePathAvatarConfigMap {
32 | g.MultiplePathAvatarConfigMap[v.AvatarID] = v
33 | }
34 |
35 | logger.Info(text.GetText(17), len(g.MultiplePathAvatarConfigMap), name)
36 | }
37 |
38 | func GetMultiplePathAvatarConfigMap() map[uint32]*MultiplePathAvatarConfig {
39 | return getConf().MultiplePathAvatarConfigMap
40 | }
41 |
42 | func GetMultiplePathAvatarConfig(avatarID uint32) *MultiplePathAvatarConfig {
43 | return getConf().MultiplePathAvatarConfigMap[avatarID]
44 | }
45 |
--------------------------------------------------------------------------------
/gdconf/music_rhythm_track.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | type MusicRhythmTrack struct {
4 | }
5 |
--------------------------------------------------------------------------------
/gdconf/npc_data.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type NPCData struct {
13 | ID uint32 `json:"ID"`
14 | ConfigEntityPath string `json:"ConfigEntityPath"`
15 | JsonPath string `json:"JsonPath"`
16 | SubType string `json:"SubType"`
17 | AnimGroupID uint32 `json:"AnimGroupID"`
18 | SeriesID uint32 `json:"SeriesID"`
19 | }
20 |
21 | func (g *GameDataConfig) loadNPCData() {
22 | g.NPCDataMap = make(map[uint32]*NPCData)
23 | nPCDataMap := make([]*NPCData, 0)
24 | name := "NPCData.json"
25 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
26 | if err != nil {
27 | panic(fmt.Sprintf(text.GetText(18), name, err))
28 | }
29 |
30 | err = hjson.Unmarshal(playerElementsFile, &nPCDataMap)
31 | if err != nil {
32 | panic(fmt.Sprintf(text.GetText(19), name, err))
33 | }
34 | for _, v := range nPCDataMap {
35 | g.NPCDataMap[v.ID] = v
36 | }
37 |
38 | logger.Info(text.GetText(17), len(g.NPCDataMap), name)
39 | }
40 |
41 | func GetNPCDataId(id uint32) *NPCData {
42 | return getConf().NPCDataMap[id]
43 | }
44 |
--------------------------------------------------------------------------------
/gdconf/npc_monster_data.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type NPCMonsterData struct {
13 | ID uint32 `json:"ID"`
14 | ConfigEntityPath string `json:"ConfigEntityPath"`
15 | NPCIconPath string `json:"NPCIconPath"`
16 | BoardShowList []uint32 `json:"BoardShowList"`
17 | JsonPath string `json:"JsonPath"`
18 | DefaultAIPath string `json:"DefaultAIPath"`
19 | CharacterType string `json:"CharacterType"`
20 | SubType string `json:"SubType"`
21 | MiniMapIconType uint32 `json:"MiniMapIconType"`
22 | Rank string `json:"Rank"`
23 | IsMazeLink bool `json:"IsMazeLink"`
24 | PrototypeID uint32 `json:"PrototypeID"`
25 | MappingInfoID uint32 `json:"MappingInfoID"`
26 | }
27 |
28 | var RankMap = map[string]int{
29 | "Unknow": 0,
30 | "Minion": 1,
31 | "MinionLv2": 2,
32 | "Elite": 3,
33 | "LittleBoss": 4,
34 | "BigBoss": 5,
35 | }
36 |
37 | func (g *GameDataConfig) loadNPCMonsterData() {
38 | g.NPCMonsterDataMap = make(map[uint32]*NPCMonsterData)
39 | nPCMonsterDataMap := make([]*NPCMonsterData, 0)
40 | name := "NPCMonsterData.json"
41 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
42 | if err != nil {
43 | panic(fmt.Sprintf(text.GetText(18), name, err))
44 | }
45 |
46 | err = hjson.Unmarshal(playerElementsFile, &nPCMonsterDataMap)
47 | if err != nil {
48 | panic(fmt.Sprintf(text.GetText(19), name, err))
49 | }
50 | for _, v := range nPCMonsterDataMap {
51 | g.NPCMonsterDataMap[v.ID] = v
52 | }
53 |
54 | logger.Info(text.GetText(17), len(g.NPCMonsterDataMap), name)
55 | }
56 |
57 | func GetNPCMonsterId(id uint32) *NPCMonsterData {
58 | return getConf().NPCMonsterDataMap[id]
59 | }
60 |
61 | func (n *NPCMonsterData) GetMonsterRank() int {
62 | return RankMap[n.Rank]
63 | }
64 |
--------------------------------------------------------------------------------
/gdconf/pet_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type Pet struct {
13 | PetMapById map[uint32]*PetConfig
14 | PetMapByItemID map[uint32]*PetConfig
15 | }
16 |
17 | type PetConfig struct {
18 | PetID uint32 `json:"PetID"`
19 | SummonUnitID uint32 `json:"SummonUnitID"`
20 | PetItemID uint32 `json:"PetItemID"`
21 | }
22 |
23 | func (g *GameDataConfig) loadPetConfig() {
24 | g.Pet = &Pet{
25 | PetMapById: make(map[uint32]*PetConfig),
26 | PetMapByItemID: make(map[uint32]*PetConfig),
27 | }
28 | petConfigList := make([]*PetConfig, 0)
29 | name := "PetConfig.json"
30 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
31 | if err != nil {
32 | panic(fmt.Sprintf(text.GetText(18), name, err))
33 | }
34 |
35 | err = hjson.Unmarshal(playerElementsFile, &petConfigList)
36 | if err != nil {
37 | panic(fmt.Sprintf(text.GetText(19), name, err))
38 | }
39 | for _, v := range petConfigList {
40 | if g.Pet.PetMapById == nil {
41 | g.Pet.PetMapById = make(map[uint32]*PetConfig)
42 | }
43 | if g.Pet.PetMapByItemID == nil {
44 | g.Pet.PetMapByItemID = make(map[uint32]*PetConfig)
45 | }
46 | g.Pet.PetMapById[v.PetID] = v
47 | g.Pet.PetMapByItemID[v.PetItemID] = v
48 | }
49 |
50 | logger.Info(text.GetText(17), len(g.Pet.PetMapById), name)
51 | }
52 |
53 | func GetPetConfigByItemId(itemId uint32) *PetConfig {
54 | return getConf().Pet.PetMapByItemID[itemId]
55 | }
56 |
57 | func GetPetConfigById(Id uint32) *PetConfig {
58 | return getConf().Pet.PetMapById[Id]
59 | }
60 |
--------------------------------------------------------------------------------
/gdconf/phone_theme_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type PhoneThemeConfig struct {
13 | ID uint32 `json:"ID"`
14 | ShowType string `json:"ShowType"`
15 | ShowParam uint32 `json:"ShowParam"`
16 | }
17 |
18 | func (g *GameDataConfig) loadPhoneThemeConfig() {
19 | g.PhoneThemeConfigMap = make(map[uint32]*PhoneThemeConfig)
20 | phoneThemeConfigist := make([]*PhoneThemeConfig, 0)
21 | name := "PhoneThemeConfig.json"
22 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &phoneThemeConfigist)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 |
32 | for _, v := range phoneThemeConfigist {
33 | g.PhoneThemeConfigMap[v.ID] = v
34 | }
35 |
36 | logger.Info(text.GetText(17), len(g.PhoneThemeConfigMap), name)
37 | }
38 |
39 | func GetPhoneThemeConfigMap() map[uint32]*PhoneThemeConfig {
40 | return getConf().PhoneThemeConfigMap
41 | }
42 |
--------------------------------------------------------------------------------
/gdconf/plane_event.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type PlaneEvent struct {
13 | EventID uint32 `json:"EventID"` // 怪物配置群
14 | WorldLevel uint32 `json:"WorldLevel"` // 世界等级
15 | StageID uint32 `json:"StageID"` // 该世界等级下怪物配置id
16 | IsUseMonsterDrop bool `json:"IsUseMonsterDrop"`
17 | DropList []uint32 `json:"DropList"`
18 | }
19 |
20 | func (g *GameDataConfig) loadPlaneEvent() {
21 | g.PlaneEventMap = make(map[uint32]map[uint32]*PlaneEvent)
22 | planeEventMap := make([]*PlaneEvent, 0)
23 | name := "PlaneEvent.json"
24 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
25 | if err != nil {
26 | panic(fmt.Sprintf(text.GetText(18), name, err))
27 | }
28 |
29 | err = hjson.Unmarshal(playerElementsFile, &planeEventMap)
30 | if err != nil {
31 | panic(fmt.Sprintf(text.GetText(19), name, err))
32 | }
33 | for _, v := range planeEventMap {
34 | if g.PlaneEventMap[v.EventID] == nil {
35 | g.PlaneEventMap[v.EventID] = make(map[uint32]*PlaneEvent)
36 | }
37 | g.PlaneEventMap[v.EventID][v.WorldLevel] = v
38 | }
39 |
40 | logger.Info(text.GetText(17), len(g.PlaneEventMap), name)
41 | }
42 |
43 | func GetPlaneEventById(eventID, worldLevel uint32) *PlaneEvent {
44 | return getConf().PlaneEventMap[eventID][worldLevel]
45 | }
46 |
--------------------------------------------------------------------------------
/gdconf/quest_data.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type QuestData struct {
13 | QuestID uint32 `json:"QuestID"`
14 | QuestType uint32 `json:"QuestType"`
15 | UnlockType string `json:"UnlockType"`
16 | RewardID uint32 `json:"RewardID"`
17 | FinishWayID uint32 `json:"FinishWayID"`
18 | GotoID uint32 `json:"GotoID"`
19 | }
20 |
21 | func (g *GameDataConfig) loadQuestData() {
22 | g.QuestDataMap = make(map[uint32]*QuestData)
23 | questDataMap := make([]*QuestData, 0)
24 | name := "QuestData.json"
25 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
26 | if err != nil {
27 | panic(fmt.Sprintf(text.GetText(18), name, err))
28 | }
29 |
30 | err = hjson.Unmarshal(playerElementsFile, &questDataMap)
31 | if err != nil {
32 | panic(fmt.Sprintf(text.GetText(19), name, err))
33 | }
34 | for _, v := range questDataMap {
35 | g.QuestDataMap[v.QuestID] = v
36 | }
37 |
38 | logger.Info(text.GetText(17), len(g.QuestDataMap), name)
39 | }
40 |
41 | func GetQuestDataById(questID uint32) *QuestData {
42 | return getConf().QuestDataMap[questID]
43 | }
44 |
45 | func GetQuestDataMap() map[uint32]*QuestData {
46 | return getConf().QuestDataMap
47 | }
48 |
--------------------------------------------------------------------------------
/gdconf/relic_exp_type.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RelicExpType struct {
13 | TypeID uint32 `json:"TypeID"`
14 | Level uint32 `json:"Level"`
15 | Exp uint32 `json:"Exp"`
16 | }
17 |
18 | func (g *GameDataConfig) loadRelicExpType() {
19 | g.RelicExpTypeMap = make(map[uint32]map[uint32]*RelicExpType)
20 | relicExpTypeMap := make([]*RelicExpType, 0)
21 | name := "RelicExpType.json"
22 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &relicExpTypeMap)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 | for _, v := range relicExpTypeMap {
32 | if g.RelicExpTypeMap[v.TypeID] == nil {
33 | g.RelicExpTypeMap[v.TypeID] = make(map[uint32]*RelicExpType)
34 | }
35 | g.RelicExpTypeMap[v.TypeID][v.Level] = v
36 | }
37 |
38 | logger.Info(text.GetText(17), len(g.RelicExpTypeMap), name)
39 | }
40 |
41 | func GetRelicExpByLevel(relicType, exp, level, relicId uint32) (uint32, uint32) {
42 | maxLevel := GetRelicMaxLevel(relicId)
43 | for ; level <= maxLevel; level++ {
44 | if exp < getConf().RelicExpTypeMap[relicType][level].Exp {
45 | return level, exp
46 | } else {
47 | exp -= getConf().RelicExpTypeMap[relicType][level].Exp
48 | }
49 | }
50 | newExp := getConf().RelicExpTypeMap[relicType][maxLevel].Exp
51 | return maxLevel, newExp
52 | }
53 |
--------------------------------------------------------------------------------
/gdconf/relic_sub_affix_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "math/rand"
6 | "os"
7 |
8 | "github.com/gucooing/hkrpg-go/pkg/logger"
9 | "github.com/gucooing/hkrpg-go/pkg/text"
10 | "github.com/hjson/hjson-go/v4"
11 | )
12 |
13 | type RelicSubAffixConfig struct {
14 | GroupID uint32 `json:"GroupID"`
15 | AffixID uint32 `json:"AffixID"`
16 | Property string `json:"Property"`
17 | StepNum uint32 `json:"StepNum"`
18 | BaseValue *Value `json:"BaseValue"`
19 | StepValue *Value `json:"StepValue"`
20 | }
21 |
22 | func (g *GameDataConfig) loadRelicSubAffixConfig() {
23 | g.RelicSubAffixConfigMap = make(map[uint32]map[uint32]*RelicSubAffixConfig)
24 | relicSubAffixConfigMap := make([]*RelicSubAffixConfig, 0)
25 | name := "RelicSubAffixConfig.json"
26 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
27 | if err != nil {
28 | panic(fmt.Sprintf(text.GetText(18), name, err))
29 | }
30 |
31 | err = hjson.Unmarshal(playerElementsFile, &relicSubAffixConfigMap)
32 | if err != nil {
33 | panic(fmt.Sprintf(text.GetText(19), name, err))
34 | }
35 | for _, v := range relicSubAffixConfigMap {
36 | if g.RelicSubAffixConfigMap[v.GroupID] == nil {
37 | g.RelicSubAffixConfigMap[v.GroupID] = make(map[uint32]*RelicSubAffixConfig)
38 | }
39 | g.RelicSubAffixConfigMap[v.GroupID][v.AffixID] = v
40 | }
41 |
42 | logger.Info(text.GetText(17), len(g.RelicSubAffixConfigMap), name)
43 | }
44 |
45 | func GetRelicSubAffixConfigById(ID uint32) *RelicSubAffixConfig {
46 | relicSubAffixConfigMap := getConf().RelicSubAffixConfigMap[ID]
47 | var keys []uint32
48 | for k := range relicSubAffixConfigMap {
49 | keys = append(keys, k)
50 | }
51 | idIndex := keys[rand.Intn(len(keys))]
52 | return relicSubAffixConfigMap[idIndex]
53 | }
54 |
55 | func GetRelicSubAffixConfig(id, index uint32) *RelicSubAffixConfig {
56 | if getConf().RelicSubAffixConfigMap[id] == nil {
57 | return nil
58 | }
59 | return getConf().RelicSubAffixConfigMap[id][index]
60 | }
61 |
--------------------------------------------------------------------------------
/gdconf/rogue_aeon_story_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueAeonStoryConfig struct {
13 | RogueAeonID uint32 `json:"RogueAeonID"`
14 | AeonStoryID uint32 `json:"AeonStoryID"`
15 | UnlockID uint32 `json:"UnlockID"`
16 | }
17 |
18 | func (g *GameDataConfig) loadRogueAeonStoryConfig() {
19 | g.RogueAeonStoryConfigMap = make(map[uint32]map[uint32]*RogueAeonStoryConfig)
20 | rogueAeonStoryConfigList := make([]*RogueAeonStoryConfig, 0)
21 | name := "RogueAeonStoryConfig.json"
22 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &rogueAeonStoryConfigList)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 | for _, v := range rogueAeonStoryConfigList {
32 | if g.RogueAeonStoryConfigMap[v.RogueAeonID] == nil {
33 | g.RogueAeonStoryConfigMap[v.RogueAeonID] = make(map[uint32]*RogueAeonStoryConfig)
34 | }
35 | g.RogueAeonStoryConfigMap[v.RogueAeonID][v.AeonStoryID] = v
36 | }
37 |
38 | logger.Info(text.GetText(17), len(g.RogueAeonStoryConfigMap), name)
39 | }
40 |
41 | func GetRogueAeonStoryConfigMap() map[uint32]map[uint32]*RogueAeonStoryConfig {
42 | return getConf().RogueAeonStoryConfigMap
43 | }
44 |
--------------------------------------------------------------------------------
/gdconf/rogue_bonus.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueBonus struct {
13 | BonusID uint32 `json:"BonusID"`
14 | BonusEvent uint32 `json:"BonusEvent"`
15 | }
16 |
17 | func (g *GameDataConfig) loadRogueBonus() {
18 | g.RogueBonusMap = make(map[uint32]*RogueBonus)
19 | rogueBonusList := make([]*RogueBonus, 0)
20 | name := "RogueBonus.json"
21 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
22 | if err != nil {
23 | panic(fmt.Sprintf(text.GetText(18), name, err))
24 | }
25 |
26 | err = hjson.Unmarshal(playerElementsFile, &rogueBonusList)
27 | if err != nil {
28 | panic(fmt.Sprintf(text.GetText(19), name, err))
29 | }
30 | for _, v := range rogueBonusList {
31 | g.RogueBonusMap[v.BonusID] = v
32 | }
33 |
34 | logger.Info(text.GetText(17), len(g.RogueBonusMap), name)
35 | }
36 |
37 | func GetRogueBonusMap() map[uint32]*RogueBonus {
38 | return getConf().RogueBonusMap
39 | }
40 |
41 | func GetRogueBonus(bonusId uint32) *RogueBonus {
42 | return getConf().RogueBonusMap[bonusId]
43 | }
44 |
--------------------------------------------------------------------------------
/gdconf/rogue_hand_book_event.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueHandBookEvent struct {
13 | EventHandbookID uint32 `json:"EventHandbookID"`
14 | EventReward uint32 `json:"EventReward"`
15 | Order uint32 `json:"Order"`
16 | EventTypeList []uint32 `json:"EventTypeList"`
17 | ImageID uint64 `json:"ImageID"`
18 | }
19 |
20 | func (g *GameDataConfig) loadRogueHandBookEvent() {
21 | g.RogueHandBookEventMap = make(map[uint32]*RogueHandBookEvent)
22 | rogueHandBookEventList := make([]*RogueHandBookEvent, 0)
23 | name := "RogueHandBookEvent.json"
24 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
25 | if err != nil {
26 | panic(fmt.Sprintf(text.GetText(18), name, err))
27 | }
28 |
29 | err = hjson.Unmarshal(playerElementsFile, &rogueHandBookEventList)
30 | if err != nil {
31 | panic(fmt.Sprintf(text.GetText(19), name, err))
32 | }
33 | for _, v := range rogueHandBookEventList {
34 | g.RogueHandBookEventMap[v.EventHandbookID] = v
35 | }
36 |
37 | logger.Info(text.GetText(17), len(g.RogueHandBookEventMap), name)
38 | }
39 |
40 | func GetRogueHandBookEventMap() map[uint32]*RogueHandBookEvent {
41 | return getConf().RogueHandBookEventMap
42 | }
43 |
44 | func GetRogueHandBookEvent(eventId uint32) *RogueHandBookEvent {
45 | return getConf().RogueHandBookEventMap[eventId]
46 | }
47 |
--------------------------------------------------------------------------------
/gdconf/rogue_handbook_miracle.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueHandbookMiracle struct {
13 | MiracleHandbookID uint32 `json:"MiracleHandbookID"`
14 | MiracleReward uint32 `json:"MiracleReward"`
15 | MiracleTypeList []uint32 `json:"MiracleTypeList"`
16 | MiracleDisplayID uint32 `json:"MiracleDisplayID"`
17 | Order uint32 `json:"Order"`
18 | MiracleIDForEffectDisplay uint32 `json:"MiracleIDForEffectDisplay"`
19 | }
20 |
21 | func (g *GameDataConfig) loadRogueHandbookMiracle() {
22 | g.RogueHandbookMiracleMap = make(map[uint32]*RogueHandbookMiracle)
23 | rogueHandbookMiracleList := make([]*RogueHandbookMiracle, 0)
24 | name := "RogueHandbookMiracle.json"
25 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
26 | if err != nil {
27 | panic(fmt.Sprintf(text.GetText(18), name, err))
28 | }
29 |
30 | err = hjson.Unmarshal(playerElementsFile, &rogueHandbookMiracleList)
31 | if err != nil {
32 | panic(fmt.Sprintf(text.GetText(19), name, err))
33 | }
34 | for _, v := range rogueHandbookMiracleList {
35 | g.RogueHandbookMiracleMap[v.MiracleHandbookID] = v
36 | }
37 |
38 | logger.Info(text.GetText(17), len(g.RogueHandbookMiracleMap), name)
39 | }
40 |
41 | func GetRogueHandbookMiracleMap() map[uint32]*RogueHandbookMiracle {
42 | return getConf().RogueHandbookMiracleMap
43 | }
44 |
45 | func GetRogueHandbookMiracle(miracleID uint32) *RogueHandbookMiracle {
46 | return getConf().RogueHandbookMiracleMap[miracleID]
47 | }
48 |
--------------------------------------------------------------------------------
/gdconf/rogue_manager.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueManagerList struct {
13 | RogueSeason uint32 `json:"RogueSeason"`
14 | RogueVersion uint32 `json:"RogueVersion"`
15 | RogueAreaIDList []uint32 `json:"RogueAreaIDList"`
16 | BeginTime string `json:"BeginTime"`
17 | EndTime string `json:"EndTime"`
18 | ScheduleDataID uint32 `json:"ScheduleDataID"`
19 | }
20 |
21 | func (g *GameDataConfig) loadRogueManager() {
22 | g.RogueManagerMap = make(map[uint32]*RogueManagerList)
23 | rogueManagerMap := make([]*RogueManagerList, 0)
24 | name := "RogueManager.json"
25 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
26 | if err != nil {
27 | panic(fmt.Sprintf(text.GetText(18), name, err))
28 | }
29 |
30 | err = hjson.Unmarshal(playerElementsFile, &rogueManagerMap)
31 | if err != nil {
32 | panic(fmt.Sprintf(text.GetText(19), name, err))
33 | }
34 |
35 | for _, v := range rogueManagerMap {
36 | g.RogueManagerMap[v.RogueSeason] = v
37 | }
38 |
39 | logger.Info(text.GetText(17), len(g.RogueManagerMap), name)
40 | }
41 |
42 | func GetRogueManager() map[uint32]*RogueManagerList {
43 | return getConf().RogueManagerMap
44 | }
45 |
46 | func GetRogueManagerById(id uint32) *RogueManagerList {
47 | return getConf().RogueManagerMap[id]
48 | }
49 |
--------------------------------------------------------------------------------
/gdconf/rogue_map.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueMap struct {
13 | StartId uint32
14 | SiteList map[uint32]*RogueMapList
15 | }
16 |
17 | type RogueMapList struct {
18 | RogueMapID uint32 `json:"RogueMapID"`
19 | SiteID uint32 `json:"SiteID"`
20 | IsStart bool `json:"IsStart"`
21 | PosX float64 `json:"PosX"`
22 | PosY float64 `json:"PosY"`
23 | NextSiteIDList []uint32 `json:"NextSiteIDList"` // 下一阶段id
24 | HardLevelGroupList []uint32 `json:"HardLevelGroupList"`
25 | LevelList []uint32 `json:"LevelList"`
26 | }
27 |
28 | func (g *GameDataConfig) loadRogueMap() {
29 | g.RogueMap = make(map[uint32]*RogueMap)
30 | rogueMap := make([]*RogueMapList, 0)
31 | name := "RogueMap.json"
32 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
33 | if err != nil {
34 | panic(fmt.Sprintf(text.GetText(18), name, err))
35 | }
36 |
37 | err = hjson.Unmarshal(playerElementsFile, &rogueMap)
38 | if err != nil {
39 | panic(fmt.Sprintf(text.GetText(19), name, err))
40 | }
41 |
42 | for _, rogueInfo := range rogueMap {
43 | if g.RogueMap[rogueInfo.RogueMapID] == nil {
44 | g.RogueMap[rogueInfo.RogueMapID] = &RogueMap{
45 | StartId: 0,
46 | SiteList: make(map[uint32]*RogueMapList),
47 | }
48 | }
49 | if rogueInfo.IsStart {
50 | g.RogueMap[rogueInfo.RogueMapID].StartId = rogueInfo.SiteID
51 | }
52 | g.RogueMap[rogueInfo.RogueMapID].SiteList[rogueInfo.SiteID] = rogueInfo
53 | }
54 |
55 | logger.Info(text.GetText(17), len(g.RogueMap), name)
56 | }
57 |
58 | func GetRogueMapSiteById(rogueMapID uint32) map[uint32]*RogueMapList {
59 | return getConf().RogueMap[rogueMapID].SiteList
60 | }
61 |
62 | func GetRogueMapById(rogueMapID uint32) *RogueMap {
63 | return getConf().RogueMap[rogueMapID]
64 | }
65 |
--------------------------------------------------------------------------------
/gdconf/rogue_map_gen.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "math/rand"
6 | "os"
7 |
8 | "github.com/gucooing/hkrpg-go/pkg/logger"
9 | "github.com/gucooing/hkrpg-go/pkg/text"
10 | "github.com/hjson/hjson-go/v4"
11 | )
12 |
13 | func (g *GameDataConfig) loadRogueMapGen() {
14 | g.RogueMapGenMap = make(map[uint32][]uint32)
15 | name := "RogueMapGen.json"
16 | playerElementsFile, err := os.ReadFile(g.dataPrefix + name)
17 | if err != nil {
18 | panic(fmt.Sprintf(text.GetText(18), name, err))
19 | }
20 |
21 | err = hjson.Unmarshal(playerElementsFile, &g.RogueMapGenMap)
22 | if err != nil {
23 | panic(fmt.Sprintf(text.GetText(19), name, err))
24 | }
25 |
26 | logger.Info(text.GetText(17), len(g.RogueMapGenMap), name)
27 | }
28 |
29 | func GetRogueRoomTypeBySiteID(siteID uint32) uint32 {
30 | rogue := getConf().RogueMapGenMap[siteID]
31 | idIndex := rand.Intn(len(rogue))
32 | typeId := rogue[idIndex]
33 |
34 | return GetRogueRoomByType(typeId)
35 | }
36 |
37 | func GetRogueRoomTypeBy100(siteID uint32) uint32 {
38 | roomMap := map[uint32]uint32{
39 | 1: 2,
40 | 2: 6,
41 | 3: 5,
42 | 4: 2,
43 | 5: 3,
44 | 6: 5,
45 | 7: 7,
46 | }
47 | return GetRogueRoomByType(roomMap[siteID])
48 | }
49 |
--------------------------------------------------------------------------------
/gdconf/rogue_maze_buff.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | type RogueMazeBuff struct {
4 | }
5 |
--------------------------------------------------------------------------------
/gdconf/rogue_monster.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueMonster struct {
13 | RogueMonsterID uint32 `json:"RogueMonsterID"`
14 | NpcMonsterID uint32 `json:"NpcMonsterID"`
15 | EventID uint32 `json:"EventID"`
16 | MonsterDropType string `json:"MonsterDropType"`
17 | }
18 |
19 | func (g *GameDataConfig) loadRogueMonster() {
20 | g.RogueMonsterMap = make(map[uint32]*RogueMonster)
21 | rogueMonsterMap := make([]*RogueMonster, 0)
22 | name := "RogueMonster.json"
23 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
24 | if err != nil {
25 | panic(fmt.Sprintf(text.GetText(18), name, err))
26 | }
27 |
28 | err = hjson.Unmarshal(playerElementsFile, &rogueMonsterMap)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(19), name, err))
31 | }
32 | for _, v := range rogueMonsterMap {
33 | g.RogueMonsterMap[v.RogueMonsterID] = v
34 | }
35 |
36 | logger.Info(text.GetText(17), len(g.RogueMonsterMap), name)
37 | }
38 |
39 | func GetRogueMonsterByRogueMonsterID(rogueMonsterID uint32) *RogueMonster {
40 | return getConf().RogueMonsterMap[rogueMonsterID]
41 | }
42 |
--------------------------------------------------------------------------------
/gdconf/rogue_monster_group.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "math/rand"
6 | "os"
7 |
8 | "github.com/gucooing/hkrpg-go/pkg/logger"
9 | "github.com/gucooing/hkrpg-go/pkg/text"
10 | "github.com/hjson/hjson-go/v4"
11 | )
12 |
13 | type RogueMonsterGroups struct {
14 | RogueMonsterGroupID uint32 `json:"RogueMonsterGroupID"`
15 | RogueMonsterListAndWeight map[uint32]float64 `json:"RogueMonsterListAndWeight"`
16 | }
17 |
18 | type RogueMonsterGroup struct {
19 | IDs []uint32
20 | AccWeights []int
21 | TotalWeight int
22 | }
23 |
24 | func (g *GameDataConfig) loadRogueMonsterGroup() {
25 | g.RogueMonsterGroupMap = make(map[uint32]*RogueMonsterGroups)
26 | rogueMonsterGroupMap := make([]*RogueMonsterGroups, 0)
27 | name := "RogueMonsterGroup.json"
28 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(18), name, err))
31 | }
32 |
33 | err = hjson.Unmarshal(playerElementsFile, &rogueMonsterGroupMap)
34 | if err != nil {
35 | panic(fmt.Sprintf(text.GetText(19), name, err))
36 | }
37 | for _, v := range rogueMonsterGroupMap {
38 | g.RogueMonsterGroupMap[v.RogueMonsterGroupID] = v
39 | }
40 |
41 | logger.Info(text.GetText(17), len(g.RogueMonsterGroupMap), name)
42 | }
43 |
44 | func GetRogueMonsterGroupByGroupID(groupID uint32) uint32 {
45 | rogue := getConf().RogueMonsterGroupMap[groupID]
46 | if rogue == nil {
47 | rogue = getConf().RogueMonsterGroupMap[1101]
48 | }
49 | return rogue.Select()
50 | }
51 |
52 | func (rmg *RogueMonsterGroups) Select() uint32 {
53 | keys := make([]uint32, 0, len(rmg.RogueMonsterListAndWeight))
54 | for key := range rmg.RogueMonsterListAndWeight {
55 | keys = append(keys, key)
56 | }
57 | randomKey := keys[rand.Intn(len(keys))]
58 | return randomKey
59 | }
60 |
--------------------------------------------------------------------------------
/gdconf/rogue_score_reward.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueScoreReward struct {
13 | RewardPoolID uint32 `json:"RewardPoolID"`
14 | ScoreRow uint32 `json:"ScoreRow"`
15 | Score uint32 `json:"Score"`
16 | Reward uint32 `json:"Reward"`
17 | }
18 |
19 | func (g *GameDataConfig) loadRogueScoreReward() {
20 | g.RogueScoreRewardMap = make(map[uint32]map[uint32]*RogueScoreReward)
21 | rogueScoreRewardList := make([]*RogueScoreReward, 0)
22 | name := "RogueScoreReward.json"
23 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
24 | if err != nil {
25 | panic(fmt.Sprintf(text.GetText(18), name, err))
26 | }
27 |
28 | err = hjson.Unmarshal(playerElementsFile, &rogueScoreRewardList)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(19), name, err))
31 | }
32 | for _, v := range rogueScoreRewardList {
33 | if g.RogueScoreRewardMap[v.RewardPoolID] == nil {
34 | g.RogueScoreRewardMap[v.RewardPoolID] = make(map[uint32]*RogueScoreReward)
35 | }
36 | g.RogueScoreRewardMap[v.RewardPoolID][v.ScoreRow] = v
37 | }
38 |
39 | logger.Info(text.GetText(17), len(g.RogueScoreRewardMap), name)
40 | }
41 |
42 | func GetRogueScoreReward(poolId, row uint32) *RogueScoreReward {
43 | if getConf().RogueScoreRewardMap[poolId] == nil {
44 | return nil
45 | }
46 | return getConf().RogueScoreRewardMap[poolId][row]
47 | }
48 |
--------------------------------------------------------------------------------
/gdconf/rogue_talent.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueTalent struct {
13 | TalentID uint32 `json:"TalentID"`
14 | IsImportant bool `json:"IsImportant"`
15 | NextTalentIDList []uint32 `json:"NextTalentIDList"`
16 | Cost []*RewardList `json:"Cost"`
17 | UnlockIDList []uint32 `json:"UnlockIDList"`
18 | Icon string `json:"Icon"`
19 | EffectDescParamList []*Value `json:"EffectDescParamList"`
20 | }
21 |
22 | func (g *GameDataConfig) loadRogueTalent() {
23 | g.RogueTalentMap = make(map[uint32]*RogueTalent)
24 | rogueTalentMap := make([]*RogueTalent, 0)
25 | name := "RogueTalent.json"
26 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
27 | if err != nil {
28 | panic(fmt.Sprintf(text.GetText(18), name, err))
29 | }
30 |
31 | err = hjson.Unmarshal(playerElementsFile, &rogueTalentMap)
32 | if err != nil {
33 | panic(fmt.Sprintf(text.GetText(19), name, err))
34 | }
35 | for _, v := range rogueTalentMap {
36 | g.RogueTalentMap[v.TalentID] = v
37 | }
38 |
39 | logger.Info(text.GetText(17), len(g.RogueTalentMap), name)
40 | }
41 |
42 | func GetRogueTalentById(talentID uint32) *RogueTalent {
43 | return getConf().RogueTalentMap[talentID]
44 | }
45 |
46 | func GetTalentIDList() []uint32 {
47 | var talentIDList []uint32
48 | for _, talent := range getConf().RogueTalentMap {
49 | talentIDList = append(talentIDList, talent.TalentID)
50 | }
51 | return talentIDList
52 | }
53 |
--------------------------------------------------------------------------------
/gdconf/rogue_tourn_area.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueTournArea struct {
13 | AreaID uint32 `json:"AreaID"`
14 | TournMode string `json:"TournMode"`
15 | WorldLevelLimit uint32 `json:"WorldLevelLimit"`
16 | AreaGroupID string `json:"AreaGroupID"`
17 | UnlockID uint32 `json:"UnlockID"`
18 | DifficultyIDList []uint32 `json:"DifficultyIDList"` // 难度列表
19 | LayerIDList []uint32 `json:"LayerIDList"` // 关卡列表
20 | Difficulty string `json:"Difficulty"`
21 | ExpScoreID uint32 `json:"ExpScoreID"` // 通关经验奖励id
22 | FirstReward uint32 `json:"FirstReward"` // 通关奖励id
23 | IsHard bool `json:"IsHard"`
24 | MonsterDisplayItemList []uint32 `json:"MonsterDisplayItemList"`
25 | }
26 |
27 | func (g *GameDataConfig) loadRogueTournArea() {
28 | g.RogueTournAreaMap = make(map[uint32]*RogueTournArea)
29 | rogueTournAreaMap := make([]*RogueTournArea, 0)
30 | name := "RogueTournArea.json"
31 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
32 | if err != nil {
33 | panic(fmt.Sprintf(text.GetText(18), name, err))
34 | }
35 |
36 | err = hjson.Unmarshal(playerElementsFile, &rogueTournAreaMap)
37 | if err != nil {
38 | panic(fmt.Sprintf(text.GetText(19), name, err))
39 | }
40 | for _, v := range rogueTournAreaMap {
41 | g.RogueTournAreaMap[v.AreaID] = v
42 | }
43 |
44 | logger.Info(text.GetText(17), len(g.RogueTournAreaMap), name)
45 | }
46 |
47 | func GetRogueTournAreaById(id uint32) *RogueTournArea {
48 | return getConf().RogueTournAreaMap[id]
49 | }
50 |
--------------------------------------------------------------------------------
/gdconf/rogue_tourn_difficulty_comp.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueTournDifficultyComp struct {
13 | DifficultyCompID uint32 `json:"DifficultyCompID"`
14 | Level uint32 `json:"Level"`
15 | }
16 |
17 | func (g *GameDataConfig) loadRogueTournDifficultyComp() {
18 | g.RogueTournDifficultyCompMap = make(map[uint32]*RogueTournDifficultyComp)
19 | rogueTournDifficultyCompMap := make([]*RogueTournDifficultyComp, 0)
20 | name := "RogueTournDifficultyComp.json"
21 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
22 | if err != nil {
23 | panic(fmt.Sprintf(text.GetText(18), name, err))
24 | }
25 |
26 | err = hjson.Unmarshal(playerElementsFile, &rogueTournDifficultyCompMap)
27 | if err != nil {
28 | panic(fmt.Sprintf(text.GetText(19), name, err))
29 | }
30 | for _, v := range rogueTournDifficultyCompMap {
31 | g.RogueTournDifficultyCompMap[v.DifficultyCompID] = v
32 | }
33 |
34 | logger.Info(text.GetText(17), len(g.RogueTournDifficultyCompMap), name)
35 | }
36 |
37 | func GetRogueTournDifficultyCompMap() map[uint32]*RogueTournDifficultyComp {
38 | return getConf().RogueTournDifficultyCompMap
39 | }
40 |
--------------------------------------------------------------------------------
/gdconf/rogue_tourn_exp_reward.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueTournExpReward struct {
13 | MainTournID uint32 `json:"MainTournID"`
14 | Level uint32 `json:"Level"`
15 | Exp uint32 `json:"Exp"`
16 | RewardID uint32 `json:"RewardID"`
17 | }
18 |
19 | func (g *GameDataConfig) loadRogueTournExpReward() {
20 | g.RogueTournExpRewardMap = make(map[uint32]map[uint32]*RogueTournExpReward)
21 | rogueTournExpRewardMap := make([]*RogueTournExpReward, 0)
22 | name := "RogueTournExpReward.json"
23 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
24 | if err != nil {
25 | panic(fmt.Sprintf(text.GetText(18), name, err))
26 | }
27 |
28 | err = hjson.Unmarshal(playerElementsFile, &rogueTournExpRewardMap)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(19), name, err))
31 | }
32 | for _, v := range rogueTournExpRewardMap {
33 | if g.RogueTournExpRewardMap[v.MainTournID] == nil {
34 | g.RogueTournExpRewardMap[v.MainTournID] = make(map[uint32]*RogueTournExpReward)
35 | }
36 | g.RogueTournExpRewardMap[v.MainTournID][v.Level] = v
37 | }
38 |
39 | logger.Info(text.GetText(17), len(g.RogueTournExpRewardMap), name)
40 | }
41 |
42 | func GetRogueTournExpRewardById(id uint32) *RogueTournExpReward {
43 | return getConf().RogueTournExpRewardMap[1][id]
44 | }
45 |
--------------------------------------------------------------------------------
/gdconf/rogue_tourn_exp_score.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueTournExpScore struct {
13 | ID uint32 `json:"ID"`
14 | ScoreExpID uint32 `json:"ScoreExpID"`
15 | WeeklyScore uint32 `json:"WeeklyScore"`
16 | Exp uint32 `json:"Exp"`
17 | }
18 |
19 | func (g *GameDataConfig) loadRogueTournExpScore() {
20 | g.RogueTournExpScoreMap = make(map[uint32]*RogueTournExpScore)
21 | rogueTournExpScoreMap := make([]*RogueTournExpScore, 0)
22 | name := "RogueTournExpScore.json"
23 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
24 | if err != nil {
25 | panic(fmt.Sprintf(text.GetText(18), name, err))
26 | }
27 |
28 | err = hjson.Unmarshal(playerElementsFile, &rogueTournExpScoreMap)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(19), name, err))
31 | }
32 | for _, v := range rogueTournExpScoreMap {
33 | g.RogueTournExpScoreMap[v.ID] = v
34 | }
35 |
36 | logger.Info(text.GetText(17), len(g.RogueTournExpScoreMap), name)
37 | }
38 |
39 | func GetRogueTournExpScoreById(id uint32) *RogueTournExpScore {
40 | return getConf().RogueTournExpScoreMap[id]
41 | }
42 |
--------------------------------------------------------------------------------
/gdconf/rogue_tourn_formula.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueTournFormula struct {
13 | FormulaID uint32 `json:"FormulaID"`
14 | TournMode string `json:"TournMode"`
15 | MainBuffTypeID uint32 `json:"MainBuffTypeID"`
16 | MainBuffNum int32 `json:"MainBuffNum"`
17 | SubBuffTypeID uint32 `json:"SubBuffTypeID"`
18 | SubBuffNum int32 `json:"SubBuffNum"`
19 | FormulaCategory string `json:"FormulaCategory"`
20 | MazeBuffID uint32 `json:"MazeBuffID"`
21 | FormulaDisplayID uint32 `json:"FormulaDisplayID"`
22 | IsInHandbook bool `json:"IsInHandbook"`
23 | UnlockDisplayID uint32 `json:"UnlockDisplayID"`
24 | }
25 |
26 | func (g *GameDataConfig) loadRogueTournFormula() {
27 | g.RogueTournFormulaMap = make(map[uint32]*RogueTournFormula)
28 | rogueTournFormulaMap := make([]*RogueTournFormula, 0)
29 | name := "RogueTournFormula.json"
30 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
31 | if err != nil {
32 | panic(fmt.Sprintf(text.GetText(18), name, err))
33 | }
34 |
35 | err = hjson.Unmarshal(playerElementsFile, &rogueTournFormulaMap)
36 | if err != nil {
37 | panic(fmt.Sprintf(text.GetText(19), name, err))
38 | }
39 | for _, v := range rogueTournFormulaMap {
40 | g.RogueTournFormulaMap[v.FormulaID] = v
41 | }
42 |
43 | logger.Info(text.GetText(17), len(g.RogueTournFormulaMap), name)
44 | }
45 |
46 | func GetRogueTournFormulaMap() map[uint32]*RogueTournFormula {
47 | return getConf().RogueTournFormulaMap
48 | }
49 |
50 | func GetRogueTournFormulaById(id uint32) *RogueTournFormula {
51 | return getConf().RogueTournFormulaMap[id]
52 | }
53 |
--------------------------------------------------------------------------------
/gdconf/rogue_tourn_permanent_talent.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type RogueTournPermanentTalent struct {
13 | TalentID uint32 `json:"TalentID"`
14 | IsImportant bool `json:"IsImportant"`
15 | NextTalentIDList []uint32 `json:"NextTalentIDList"`
16 | Cost []*Cost `json:"Cost"`
17 | }
18 |
19 | type Cost struct {
20 | ItemID uint32 `json:"ItemID"`
21 | ItemNum uint32 `json:"ItemNum"`
22 | }
23 |
24 | func (g *GameDataConfig) loadRogueTournPermanentTalent() {
25 | g.RogueTournPermanentTalentMap = make(map[uint32]*RogueTournPermanentTalent)
26 | rogueTournPermanentTalentMap := make([]*RogueTournPermanentTalent, 0)
27 | name := "RogueTournPermanentTalent.json"
28 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(18), name, err))
31 | }
32 |
33 | err = hjson.Unmarshal(playerElementsFile, &rogueTournPermanentTalentMap)
34 | if err != nil {
35 | panic(fmt.Sprintf(text.GetText(19), name, err))
36 | }
37 | for _, v := range rogueTournPermanentTalentMap {
38 | g.RogueTournPermanentTalentMap[v.TalentID] = v
39 | }
40 |
41 | logger.Info(text.GetText(17), len(g.RogueTournPermanentTalentMap), name)
42 | }
43 |
44 | func GetRogueTournPermanentTalentMap() map[uint32]*RogueTournPermanentTalent {
45 | return getConf().RogueTournPermanentTalentMap
46 | }
47 |
--------------------------------------------------------------------------------
/gdconf/special_prop.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type SpecialProp struct {
13 | EntryId uint32 `json:"EntryId"`
14 | GroupList map[uint32]*GroupList `json:"GroupList"`
15 | }
16 | type GroupList struct {
17 | GroupId uint32 `json:"GroupId"`
18 | PropState map[uint32]string `json:"PropState"`
19 | }
20 |
21 | func (g *GameDataConfig) loadSpecialProp() {
22 | g.SpecialPropMap = make(map[uint32]*SpecialProp)
23 | name := "SpecialProp.json"
24 | playerElementsFile, err := os.ReadFile(g.dataPrefix + name)
25 | if err != nil {
26 | panic(fmt.Sprintf(text.GetText(18), name, err))
27 | }
28 |
29 | err = hjson.Unmarshal(playerElementsFile, &g.SpecialPropMap)
30 | if err != nil {
31 | panic(fmt.Sprintf(text.GetText(19), name, err))
32 | }
33 |
34 | logger.Info(text.GetText(17), len(g.SpecialPropMap), name)
35 | }
36 |
37 | func GetSpecialProp(entryId uint32) *SpecialProp {
38 | return getConf().SpecialPropMap[entryId]
39 | }
40 |
--------------------------------------------------------------------------------
/gdconf/stage_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type StageConfig struct {
13 | StageID uint32 `json:"StageID"` // 具体怪物id群
14 | StageType string `json:"StageType"` // 怪物类型
15 | HardLevelGroup uint32 `json:"HardLevelGroup"` // 强度等级
16 | MonsterList []map[string]uint32 `json:"MonsterList"` // 怪物id
17 | ForbidExitBattle bool `json:"ForbidExitBattle"` // 禁止退出
18 | ForbidAutoBattle bool `json:"ForbidAutoBattle"`
19 | Release bool `json:"Release"`
20 | ResetBattleSpeed bool `json:"ResetBattleSpeed"`
21 | TrialAvatarList []uint32 `json:"TrialAvatarList"` // 试用角色
22 | }
23 |
24 | func (g *GameDataConfig) loadStageConfig() {
25 | g.StageConfigMap = make(map[uint32]*StageConfig)
26 | stageConfigMap := make([]*StageConfig, 0)
27 | name := "StageConfig.json"
28 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(18), name, err))
31 | }
32 |
33 | err = hjson.Unmarshal(playerElementsFile, &stageConfigMap)
34 | if err != nil {
35 | panic(fmt.Sprintf(text.GetText(19), name, err))
36 | }
37 | for _, v := range stageConfigMap {
38 | g.StageConfigMap[v.StageID] = v
39 | }
40 |
41 | logger.Info(text.GetText(17), len(g.StageConfigMap), name)
42 | }
43 |
44 | func GetStageConfigById(stageID uint32) *StageConfig {
45 | return getConf().StageConfigMap[stageID]
46 | }
47 |
--------------------------------------------------------------------------------
/gdconf/story_line.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type StoryLine struct {
13 | StoryLineID uint32 `json:"StoryLineID"`
14 | BeginCondition *Condition `json:"BeginCondition"`
15 | EndCondition *Condition `json:"EndCondition"`
16 | ShowCondition string `json:"ShowCondition"`
17 | InitEntranceID uint32 `json:"InitEntranceID"`
18 | InitGroupID uint32 `json:"InitGroupID"`
19 | InitAnchorID uint32 `json:"InitAnchorID"`
20 | PerformanceStoryAvatar string `json:"PerformanceStoryAvatar"`
21 | EarlyAccessContentID uint32 `json:"EarlyAccessContentID"`
22 | }
23 |
24 | type Condition struct {
25 | Type string `json:"Type"`
26 | Param string `json:"Param"`
27 | }
28 |
29 | func (g *GameDataConfig) loadStoryLine() {
30 | g.StoryLineMap = make(map[uint32]*StoryLine)
31 | storyLineList := make([]*StoryLine, 0)
32 | name := "StoryLine.json"
33 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
34 | if err != nil {
35 | panic(fmt.Sprintf(text.GetText(18), name, err))
36 | }
37 |
38 | err = hjson.Unmarshal(playerElementsFile, &storyLineList)
39 | if err != nil {
40 | panic(fmt.Sprintf(text.GetText(19), name, err))
41 | }
42 | for _, v := range storyLineList {
43 | g.StoryLineMap[v.StoryLineID] = v
44 | }
45 |
46 | logger.Info(text.GetText(17), len(g.StoryLineMap), name)
47 | }
48 |
49 | func GetStoryLine(storyLineID uint32) *StoryLine {
50 | return getConf().StoryLineMap[storyLineID]
51 | }
52 |
--------------------------------------------------------------------------------
/gdconf/story_line_floor_data.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type StoryLineFloorData struct {
13 | FloorID uint32 `json:"FloorID"`
14 | StoryLineID uint32 `json:"StoryLineID"`
15 | ConditionExpression string `json:"ConditionExpression"`
16 | DimensionID uint32 `json:"DimensionID"`
17 | }
18 |
19 | func (g *GameDataConfig) loadStoryLineFloorData() {
20 | g.StoryLineFloorDataMap = make(map[uint32]*StoryLineFloorData)
21 | storyLineFloorDataList := make([]*StoryLineFloorData, 0)
22 | name := "StoryLineFloorData.json"
23 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
24 | if err != nil {
25 | panic(fmt.Sprintf(text.GetText(18), name, err))
26 | }
27 |
28 | err = hjson.Unmarshal(playerElementsFile, &storyLineFloorDataList)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(19), name, err))
31 | }
32 | for _, v := range storyLineFloorDataList {
33 | g.StoryLineFloorDataMap[v.StoryLineID] = v
34 | }
35 |
36 | logger.Info(text.GetText(17), len(g.StoryLineFloorDataMap), name)
37 | }
38 |
39 | func GetStoryLineFloorData(id uint32) *StoryLineFloorData {
40 | return getConf().StoryLineFloorDataMap[id]
41 | }
42 |
--------------------------------------------------------------------------------
/gdconf/stroy_line_trial_avatar_data.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type StroyLineTrialAvatarData struct {
13 | StoryLineID uint32 `json:"StoryLineID"`
14 | TrialAvatarList []uint32 `json:"TrialAvatarList"`
15 | InitTrialAvatarList []uint32 `json:"InitTrialAvatarList"`
16 | CaptainAvatarID uint32 `json:"CaptainAvatarID"`
17 | }
18 |
19 | func (g *GameDataConfig) loadStroyLineTrialAvatarData() {
20 | g.StroyLineTrialAvatarDataMap = make(map[uint32]*StroyLineTrialAvatarData)
21 | stroyLineTrialAvatarDataList := make([]*StroyLineTrialAvatarData, 0)
22 | name := "StroyLineTrialAvatarData.json"
23 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
24 | if err != nil {
25 | panic(fmt.Sprintf(text.GetText(18), name, err))
26 | }
27 |
28 | err = hjson.Unmarshal(playerElementsFile, &stroyLineTrialAvatarDataList)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(19), name, err))
31 | }
32 | for _, v := range stroyLineTrialAvatarDataList {
33 | g.StroyLineTrialAvatarDataMap[v.StoryLineID] = v
34 | }
35 |
36 | logger.Info(text.GetText(17), len(g.StroyLineTrialAvatarDataMap), name)
37 | }
38 |
39 | func GetStroyLineTrialAvatarData(id uint32) *StroyLineTrialAvatarData {
40 | return getConf().StroyLineTrialAvatarDataMap[id]
41 | }
42 |
--------------------------------------------------------------------------------
/gdconf/text_join_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type TextJoinConfig struct {
13 | TextJoinID uint32 `json:"TextJoinID"`
14 | DefaultItem uint32 `json:"DefaultItem"`
15 | TextJoinItemList []uint32 `json:"TextJoinItemList"`
16 | }
17 |
18 | func (g *GameDataConfig) loadTextJoinConfig() {
19 | g.TextJoinConfigMap = make(map[uint32]*TextJoinConfig)
20 | textJoinConfigMap := make([]*TextJoinConfig, 0)
21 | name := "TextJoinConfig.json"
22 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &textJoinConfigMap)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 | for _, v := range textJoinConfigMap {
32 | g.TextJoinConfigMap[v.TextJoinID] = v
33 | }
34 |
35 | logger.Info(text.GetText(17), len(g.TextJoinConfigMap), name)
36 | }
37 |
38 | func GetTextJoinConfigById(ID uint32) *TextJoinConfig {
39 | return getConf().TextJoinConfigMap[ID]
40 | }
41 |
42 | func GetTextJoinConfigMap() map[uint32]*TextJoinConfig {
43 | return getConf().TextJoinConfigMap
44 | }
45 |
--------------------------------------------------------------------------------
/gdconf/train_party_area_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type TrainPartyAreaConfig struct {
13 | ID uint32 `json:"ID"`
14 | Sort uint32 `json:"Sort"`
15 | RequireAreaID uint32 `json:"RequireAreaID"`
16 | ProgressBonusList []*ProgressBonus `json:"ProgressBonusList"`
17 | HiddenBlockList []string `json:"HiddenBlockList"`
18 | ShowBlockList []string `json:"ShowBlockList"`
19 | FirstStep uint32 `json:"FirstStep"`
20 | }
21 |
22 | type ProgressBonus struct {
23 | Progress uint32 `json:"Progress"`
24 | AddStar uint32 `json:"AddStar"`
25 | }
26 |
27 | func (g *GameDataConfig) loadTrainPartyAreaConfig() {
28 | g.TrainPartyAreaConfigMap = make(map[uint32]*TrainPartyAreaConfig)
29 | trainPartyAreaConfigList := make([]*TrainPartyAreaConfig, 0)
30 | name := "TrainPartyAreaConfig.json"
31 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
32 | if err != nil {
33 | panic(fmt.Sprintf(text.GetText(18), name, err))
34 | }
35 |
36 | err = hjson.Unmarshal(playerElementsFile, &trainPartyAreaConfigList)
37 | if err != nil {
38 | panic(fmt.Sprintf(text.GetText(19), name, err))
39 | }
40 | for _, v := range trainPartyAreaConfigList {
41 | g.TrainPartyAreaConfigMap[v.ID] = v
42 | }
43 |
44 | logger.Info(text.GetText(17), len(g.TrainPartyAreaConfigMap), name)
45 | }
46 |
47 | func GetTrainPartyAreaConfigMap() map[uint32]*TrainPartyAreaConfig {
48 | return getConf().TrainPartyAreaConfigMap
49 | }
50 |
--------------------------------------------------------------------------------
/gdconf/train_party_area_goal_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type TrainPartyAreaGoalConfig struct {
13 | ID uint32 `json:"ID"`
14 | AreaID uint32 `json:"AreaID"`
15 | StepGroupList []uint32 `json:"StepGroupList"`
16 | }
17 |
18 | func (g *GameDataConfig) loadTrainPartyAreaGoalConfig() {
19 | g.TrainPartyAreaGoalConfigMap = make(map[uint32]*TrainPartyAreaGoalConfig)
20 | trainPartyAreaGoalConfigList := make([]*TrainPartyAreaGoalConfig, 0)
21 | name := "TrainPartyAreaGoalConfig.json"
22 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &trainPartyAreaGoalConfigList)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 | for _, v := range trainPartyAreaGoalConfigList {
32 | g.TrainPartyAreaGoalConfigMap[v.AreaID] = v
33 | }
34 |
35 | logger.Info(text.GetText(17), len(g.TrainPartyAreaGoalConfigMap), name)
36 | }
37 |
38 | func GetTrainPartyAreaGoalConfigMap() map[uint32]*TrainPartyAreaGoalConfig {
39 | return getConf().TrainPartyAreaGoalConfigMap
40 | }
41 |
42 | func GetTrainPartyAreaGoalConfigByAreaId(areaID uint32) *TrainPartyAreaGoalConfig {
43 | return getConf().TrainPartyAreaGoalConfigMap[areaID]
44 | }
45 |
--------------------------------------------------------------------------------
/gdconf/train_party_card_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/constant"
8 | "github.com/gucooing/hkrpg-go/pkg/logger"
9 | "github.com/gucooing/hkrpg-go/pkg/text"
10 | "github.com/hjson/hjson-go/v4"
11 | )
12 |
13 | type TrainPartyCardConfig struct {
14 | CardID uint32 `json:"CardID"`
15 | PassengerID uint32 `json:"PassengerID"`
16 | CardType constant.TrainPartyCardType `json:"CardType"`
17 | Rarity uint32 `json:"Rarity"`
18 | UpgradeLevel uint32 `json:"UpgradeLevel"`
19 | CardActJson string `json:"CardActJson"`
20 | CardEffectJson string `json:"CardEffectJson"`
21 | }
22 |
23 | func (g *GameDataConfig) loadTrainPartyCardConfig() {
24 | g.TrainPartyCardConfigMap = make(map[uint32]*TrainPartyCardConfig)
25 | TrainPartyCardConfigList := make([]*TrainPartyCardConfig, 0)
26 | name := "TrainPartyCardConfig.json"
27 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(18), name, err))
30 | }
31 |
32 | err = hjson.Unmarshal(playerElementsFile, &TrainPartyCardConfigList)
33 | if err != nil {
34 | panic(fmt.Sprintf(text.GetText(19), name, err))
35 | }
36 | for _, v := range TrainPartyCardConfigList {
37 | g.TrainPartyCardConfigMap[v.CardID] = v
38 | }
39 |
40 | logger.Info(text.GetText(17), len(g.TrainPartyCardConfigMap), name)
41 | }
42 |
43 | func GetTrainPartyCardConfigMap() map[uint32]*TrainPartyCardConfig {
44 | return getConf().TrainPartyCardConfigMap
45 | }
46 |
--------------------------------------------------------------------------------
/gdconf/train_party_passenger_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type TrainPartyPassengerConfig struct {
13 | PassengerID uint32 `json:"PassengerID"`
14 | DiaryOrder uint32 `json:"DiaryOrder"`
15 | PassengerQuest uint32 `json:"PassengerQuest"`
16 | }
17 |
18 | func (g *GameDataConfig) loadTrainPartyPassengerConfig() {
19 | g.TrainPartyPassengerConfigMap = make(map[uint32]*TrainPartyPassengerConfig)
20 | trainPartyPassengerConfigList := make([]*TrainPartyPassengerConfig, 0)
21 | name := "TrainPartyPassengerConfig.json"
22 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &trainPartyPassengerConfigList)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 | for _, v := range trainPartyPassengerConfigList {
32 | g.TrainPartyPassengerConfigMap[v.PassengerID] = v
33 | }
34 |
35 | logger.Info(text.GetText(17), len(g.TrainPartyPassengerConfigMap), name)
36 | }
37 |
38 | func GetTrainPartyPassengerConfigMap() map[uint32]*TrainPartyPassengerConfig {
39 | return getConf().TrainPartyPassengerConfigMap
40 | }
41 |
--------------------------------------------------------------------------------
/gdconf/train_party_step_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type TrainPartyStepConfig struct {
13 | ID uint32 `json:"ID"`
14 | GroupID uint32 `json:"GroupID"`
15 | CoinCost uint32 `json:"CoinCost"`
16 | SortID uint32 `json:"SortID"`
17 | StaticPropIDList []uint32 `json:"StaticPropIDList"`
18 | HasPreview bool `json:"HasPreview"`
19 | HasCutScene bool `json:"HasCutScene"`
20 | }
21 |
22 | func (g *GameDataConfig) loadTrainPartyStepConfig() {
23 | g.TrainPartyStepConfigMap = make(map[uint32]*TrainPartyStepConfig)
24 | trainPartyStepConfigList := make([]*TrainPartyStepConfig, 0)
25 | name := "TrainPartyStepConfig.json"
26 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
27 | if err != nil {
28 | panic(fmt.Sprintf(text.GetText(18), name, err))
29 | }
30 |
31 | err = hjson.Unmarshal(playerElementsFile, &trainPartyStepConfigList)
32 | if err != nil {
33 | panic(fmt.Sprintf(text.GetText(19), name, err))
34 | }
35 | for _, v := range trainPartyStepConfigList {
36 | g.TrainPartyStepConfigMap[v.ID] = v
37 | }
38 |
39 | logger.Info(text.GetText(17), len(g.TrainPartyStepConfigMap), name)
40 | }
41 |
42 | func GetTrainPartyStepConfigMap() map[uint32]*TrainPartyStepConfig {
43 | return getConf().TrainPartyStepConfigMap
44 | }
45 |
46 | func GetTrainPartyStepConfig(firstStep uint32) *TrainPartyStepConfig {
47 | return getConf().TrainPartyStepConfigMap[firstStep]
48 | }
49 |
50 | func GetTrainPartyStepConfigByGroupId(groupId uint32) []*TrainPartyStepConfig {
51 | list := make([]*TrainPartyStepConfig, 0)
52 | for _, v := range getConf().TrainPartyStepConfigMap {
53 | if v.GroupID == groupId {
54 | list = append(list, v)
55 | }
56 | }
57 | return list
58 | }
59 |
--------------------------------------------------------------------------------
/gdconf/train_visitor_config.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type TrainVisitorConfig struct {
13 | VisitorID uint32 `json:"VisitorID"`
14 | MissionID uint32 `json:"MissionID"`
15 | LockMissionID uint32 `json:"LockMissionID"`
16 | AvatarID uint32 `json:"AvatarID"`
17 | ToastFinishMainMission bool `json:"ToastFinishMainMission"`
18 | }
19 |
20 | func (g *GameDataConfig) loadTrainVisitorConfig() {
21 | g.TrainVisitorConfigMap = make([]*TrainVisitorConfig, 0)
22 | name := "TrainVisitorConfig.json"
23 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
24 | if err != nil {
25 | panic(fmt.Sprintf(text.GetText(18), name, err))
26 | }
27 |
28 | err = hjson.Unmarshal(playerElementsFile, &g.TrainVisitorConfigMap)
29 | if err != nil {
30 | panic(fmt.Sprintf(text.GetText(19), name, err))
31 | }
32 |
33 | logger.Info(text.GetText(17), len(g.TrainVisitorConfigMap), name)
34 | }
35 |
36 | func GetTrainVisitorConfigMap() []*TrainVisitorConfig {
37 | return getConf().TrainVisitorConfigMap
38 | }
39 |
--------------------------------------------------------------------------------
/gdconf/tutorial_data.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type TutorialData struct {
13 | TutorialID uint32 `json:"TutorialID"`
14 | Priority uint32 `json:"Priority"`
15 | CanInterrupt bool `json:"CanInterrupt"`
16 | }
17 |
18 | func (g *GameDataConfig) loadTutorialData() {
19 | g.TutorialDataMap = make(map[uint32]*TutorialData)
20 | tutorialDataMap := make([]*TutorialData, 0)
21 | name := "TutorialData.json"
22 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
23 | if err != nil {
24 | panic(fmt.Sprintf(text.GetText(18), name, err))
25 | }
26 |
27 | err = hjson.Unmarshal(playerElementsFile, &tutorialDataMap)
28 | if err != nil {
29 | panic(fmt.Sprintf(text.GetText(19), name, err))
30 | }
31 | for _, v := range tutorialDataMap {
32 | g.TutorialDataMap[v.TutorialID] = v
33 | }
34 |
35 | logger.Info(text.GetText(17), len(g.TutorialDataMap), name)
36 | }
37 |
38 | func GetTutorialData() map[uint32]*TutorialData {
39 | return getConf().TutorialDataMap
40 | }
41 |
--------------------------------------------------------------------------------
/gdconf/tutorial_guide_group.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type TutorialGuideGroup struct {
13 | GroupID uint32 `json:"GroupID"`
14 | TutorialGuideIDList []uint32 `json:"TutorialGuideIDList"`
15 | TutorialType uint32 `json:"TutorialType"`
16 | CanReview bool `json:"CanReview"`
17 | TutorialShowType string `json:"TutorialShowType"`
18 | Order uint32 `json:"Order"`
19 | RewardID uint32 `json:"RewardID"`
20 | }
21 |
22 | func (g *GameDataConfig) loadTutorialGuideGroup() {
23 | g.TutorialGuideGroupMap = make(map[uint32]*TutorialGuideGroup)
24 | tutorialGuideGroupMap := make([]*TutorialGuideGroup, 0)
25 | name := "TutorialGuideGroup.json"
26 | playerElementsFile, err := os.ReadFile(g.excelPrefix + name)
27 | if err != nil {
28 | panic(fmt.Sprintf(text.GetText(18), name, err))
29 | }
30 |
31 | err = hjson.Unmarshal(playerElementsFile, &tutorialGuideGroupMap)
32 | if err != nil {
33 | panic(fmt.Sprintf(text.GetText(19), name, err))
34 | }
35 | for _, v := range tutorialGuideGroupMap {
36 | g.TutorialGuideGroupMap[v.GroupID] = v
37 | }
38 |
39 | logger.Info(text.GetText(17), len(g.TutorialGuideGroupMap), name)
40 | }
41 |
42 | func GetTutorialGuideGroupMap() map[uint32]*TutorialGuideGroup {
43 | return getConf().TutorialGuideGroupMap
44 | }
45 |
46 | func GetTutorialGuideGroup(groupID uint32) *TutorialGuideGroup {
47 | return getConf().TutorialGuideGroupMap[groupID]
48 | }
49 |
--------------------------------------------------------------------------------
/gdconf/video_version_key.go:
--------------------------------------------------------------------------------
1 | package gdconf
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/logger"
8 | "github.com/gucooing/hkrpg-go/pkg/text"
9 | "github.com/hjson/hjson-go/v4"
10 | )
11 |
12 | type VideoVersionKey struct {
13 | ActivityVideoKeyInfoList []*VideoKeyInfo `json:"activityVideoKeyInfoList"`
14 | VideoKeyInfoList []*VideoKeyInfo `json:"videoKeyInfoList"`
15 | }
16 |
17 | type VideoKeyInfo struct {
18 | Id uint32 `json:"id"`
19 | VideoKey uint64 `json:"videoKey"`
20 | }
21 |
22 | func (g *GameDataConfig) loadVideoVersionKey() {
23 | g.VideoVersionKey = new(VideoVersionKey)
24 | name := "VideoVersionKey.json"
25 | playerElementsFile, err := os.ReadFile(g.dataPrefix + name)
26 | if err != nil {
27 | panic(fmt.Sprintf(text.GetText(18), name, err))
28 | }
29 |
30 | err = hjson.Unmarshal(playerElementsFile, &g.VideoVersionKey)
31 | if err != nil {
32 | panic(fmt.Sprintf(text.GetText(19), name, err))
33 | }
34 |
35 | logger.Info(text.GetText(17), len(g.VideoVersionKey.VideoKeyInfoList)+len(g.VideoVersionKey.ActivityVideoKeyInfoList), name)
36 | }
37 |
38 | func GetVideoVersionKey() *VideoVersionKey {
39 | return getConf().VideoVersionKey
40 | }
41 |
--------------------------------------------------------------------------------
/muipserver/app/app.go:
--------------------------------------------------------------------------------
1 | package app
2 |
--------------------------------------------------------------------------------
/muipserver/db/start.go:
--------------------------------------------------------------------------------
1 | package db
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/gucooing/hkrpg-go/muipserver/config"
7 | "github.com/gucooing/hkrpg-go/pkg/constant"
8 | "github.com/gucooing/hkrpg-go/pkg/database"
9 | "github.com/gucooing/hkrpg-go/pkg/logger"
10 | "github.com/redis/go-redis/v9"
11 | "gorm.io/gorm"
12 | )
13 |
14 | type Store struct {
15 | config *config.Config
16 | PlayerDataMysql *gorm.DB
17 | LoginRedis *redis.Client
18 | StatusRedis *redis.Client
19 | PlayerBriefDataRedis *redis.Client // 玩家简要信息
20 | }
21 |
22 | var ctx = context.Background()
23 |
24 | // NewStore 创建一个新的 store。
25 | func NewStore(config *config.Config) *Store {
26 | s := &Store{config: config}
27 | mysqlPlayerDataConf := config.MysqlConf["player"]
28 | s.PlayerDataMysql = database.NewMysql(mysqlPlayerDataConf.Dsn)
29 | s.PlayerDataMysql.AutoMigrate(&constant.PlayerData{})
30 |
31 | redisLoginConf := config.RedisConf["player_login"]
32 | s.LoginRedis = database.NewRedis(redisLoginConf.Addr, redisLoginConf.Password, redisLoginConf.DB)
33 | redisStatusConf := config.RedisConf["player_status"]
34 | s.StatusRedis = database.NewRedis(redisStatusConf.Addr, redisStatusConf.Password, redisStatusConf.DB)
35 | playerBriefDataRedis := config.RedisConf["player_brief_data"]
36 | s.PlayerBriefDataRedis = database.NewRedis(playerBriefDataRedis.Addr, playerBriefDataRedis.Password, playerBriefDataRedis.DB)
37 |
38 | logger.Info("数据库连接成功")
39 | return s
40 | }
41 |
--------------------------------------------------------------------------------
/nodeserver/service/message_queue.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/pkg/logger"
5 | "github.com/gucooing/hkrpg-go/pkg/mq"
6 | smd "github.com/gucooing/hkrpg-go/protocol/server"
7 | spb "github.com/gucooing/hkrpg-go/protocol/server/proto"
8 | pb "google.golang.org/protobuf/proto"
9 | )
10 |
11 | type HandlerFunc func(s *NodeDiscoveryService, payloadMsg pb.Message)
12 |
13 | var handlerFuncRouteMap map[uint16]HandlerFunc
14 |
15 | func init() {
16 | handlerFuncRouteMap = map[uint16]HandlerFunc{
17 | smd.PlayerLogoutRsp: playerLogoutRsp, // 下线回调
18 | }
19 | }
20 |
21 | func playerLogoutRsp(s *NodeDiscoveryService, payloadMsg pb.Message) {
22 | req := payloadMsg.(*spb.PlayerLogoutRsp)
23 | if req.Status == spb.LOGOUTSTATUS_OFFLINE_REPEAT_LOGIN {
24 | s.MessageQueue.SendToGate(req.GateAppId, &mq.NetMsg{
25 | MsgType: mq.PlayerLoginKill,
26 | Uid: req.Uid,
27 | })
28 | }
29 | }
30 |
31 | func (s *NodeDiscoveryService) messageQueue() {
32 | for {
33 | netMsg := <-s.MessageQueue.GetNetMsg()
34 | switch netMsg.OriginServerType {
35 | case spb.ServerType_SERVICE_GATE:
36 | go s.gateMsgHandle(netMsg)
37 | default:
38 | logger.Error("unknow server type: %v", netMsg.OriginServerType)
39 | }
40 | }
41 | }
42 |
43 | func (s *NodeDiscoveryService) gateMsgHandle(netMsg *mq.NetMsg) {
44 | switch netMsg.MsgType {
45 | case mq.ServerMsg:
46 | handle, ok := handlerFuncRouteMap[netMsg.CmdId]
47 | if !ok {
48 | logger.Error("server msg error,cmd:%s",
49 | smd.GetSharedCmdProtoMap().GetCmdNameByCmdId(netMsg.CmdId))
50 | return
51 | }
52 | handle(s, netMsg.ServiceMsgPb)
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/pkg/alg/getec2b.go:
--------------------------------------------------------------------------------
1 | package alg
2 |
3 | import (
4 | "io"
5 | "io/ioutil"
6 | "os"
7 |
8 | "github.com/gucooing/hkrpg-go/pkg/logger"
9 | "github.com/gucooing/hkrpg-go/pkg/random"
10 | "github.com/gucooing/hkrpg-go/pkg/text"
11 | )
12 |
13 | func GetEc2b() *random.Ec2b {
14 | open, err := os.Open("data/Ec2b.bin")
15 | defer open.Close()
16 | if err != nil {
17 | ec2p := random.NewEc2b()
18 | ioutil.WriteFile("data/Ec2b.bin", ec2p.Bytes(), 0644)
19 | logger.Info(text.GetText(10))
20 | return ec2p
21 | } else {
22 | ec2p, err := io.ReadAll(open)
23 | if err != nil {
24 | logger.Error(text.GetText(11), err)
25 | return nil
26 | }
27 | defer open.Close()
28 | ec2b, err := random.LoadEc2bKey(ec2p)
29 | if err != nil {
30 | logger.Error(text.GetText(12), err)
31 | return nil
32 | }
33 | logger.Info(text.GetText(13))
34 | return ec2b
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/pkg/alg/http.go:
--------------------------------------------------------------------------------
1 | package alg
2 |
3 | import (
4 | "fmt"
5 | "net/http"
6 |
7 | "github.com/gucooing/hkrpg-go/pkg/constant"
8 | "github.com/gucooing/hkrpg-go/pkg/logger"
9 | )
10 |
11 | func NewHttp(netInfo constant.AppNet, handler http.Handler) error {
12 | addr := fmt.Sprintf("%s:%s", netInfo.InnerAddr, netInfo.InnerPort)
13 | logger.Info("http监听地址:%s", addr)
14 | logger.Info("http对外地址:%s", fmt.Sprintf("%s:%s", netInfo.OuterAddr, netInfo.OuterPort))
15 | server := &http.Server{Addr: addr, Handler: handler}
16 | return server.ListenAndServe()
17 | }
18 |
--------------------------------------------------------------------------------
/pkg/alg/math.go:
--------------------------------------------------------------------------------
1 | package alg
2 |
3 | func MaxUin32(x, y uint32) uint32 {
4 | if x > y {
5 | return x
6 | }
7 | return y
8 | }
9 |
--------------------------------------------------------------------------------
/pkg/build.go:
--------------------------------------------------------------------------------
1 | package pkg
2 |
3 | const (
4 | AppVersion = "1.8.0-dev"
5 | GameVersion = "2.7.5x"
6 | )
7 |
8 | func GetAppVersion() string {
9 | return AppVersion
10 | }
11 |
12 | func GetGameVersion() string {
13 | return GameVersion
14 | }
15 |
--------------------------------------------------------------------------------
/pkg/constant/activity.go:
--------------------------------------------------------------------------------
1 | package constant
2 |
3 | type ClockParkScriptType string
4 |
5 | const (
6 | ClockParkScriptTypeNormal ClockParkScriptType = "Normal"
7 | ClockParkScriptTypeEndless ClockParkScriptType = "Endless"
8 | )
9 |
--------------------------------------------------------------------------------
/pkg/constant/banner.go:
--------------------------------------------------------------------------------
1 | package constant
2 |
3 | type GachaType string
4 |
5 | const (
6 | GachaTypeNormal GachaType = "Normal"
7 | GachaTypeAvatarUp GachaType = "AvatarUp"
8 | GachaTypeWeaponUp GachaType = "WeaponUp"
9 | )
10 |
--------------------------------------------------------------------------------
/pkg/constant/config.go:
--------------------------------------------------------------------------------
1 | package constant
2 |
3 | type AppList struct {
4 | App map[string]AppNet `json:"app"`
5 | RegionName string `json:"region_name"`
6 | MqAddr string `json:"mq_addr"`
7 | GrpcAddr string `json:"grpc_addr"`
8 | GateTcp bool `json:"gate_tcp"`
9 | }
10 |
11 | type AppNet struct {
12 | InnerAddr string `json:"InnerAddr"`
13 | InnerPort string `json:"InnerPort"`
14 | OuterAddr string `json:"OuterAddr"`
15 | OuterPort string `json:"OuterPort"`
16 | }
17 |
18 | type MysqlConf struct {
19 | Dsn string `json:"dsn"`
20 | }
21 |
22 | type RedisConf struct {
23 | Addr string `json:"addr"`
24 | Password string `json:"password"`
25 | DB int `json:"db"`
26 | }
27 |
--------------------------------------------------------------------------------
/pkg/constant/push.go:
--------------------------------------------------------------------------------
1 | package constant
2 |
3 | import (
4 | "database/sql"
5 | "time"
6 | )
7 |
8 | type ServiceLog struct {
9 | LogLevel LogLevel `gorm:"primarykey"`
10 | LogId uint64 `gorm:"primarykey"`
11 | Tag string `gorm:"primarykey"` // 自由tag
12 | LogAddTime sql.NullTime // 添加时间
13 | LogValidTime sql.NullTime // 有效时间
14 | LogMsg string // log 内容
15 | }
16 |
17 | type LogLevel int
18 |
19 | const (
20 | DEBUG = 0
21 | INFO = 1
22 | WARN = 2 // 警告!将会触发通知
23 | ERROR = 3 // 严重错误!将会触发通知
24 | )
25 |
26 | type PushMessageAll interface {
27 | push()
28 | }
29 |
30 | type PushMessage struct {
31 | Tag string // 自定义tag
32 | }
33 |
34 | func (l *LogPush) push() {}
35 |
36 | type LogPush struct {
37 | PushMessage
38 | LogLevel LogLevel // 等级
39 | LogValidTime time.Time // 有效时间
40 | LogMsg string // 内容
41 | }
42 |
--------------------------------------------------------------------------------
/pkg/constant/rogue.go:
--------------------------------------------------------------------------------
1 | package constant
2 |
3 | type RogueTournRoomType uint32
4 |
5 | const (
6 | RogueTournRoomTypeUnknown RogueTournRoomType = 0
7 | RogueTournRoomTypeBoss RogueTournRoomType = 1
8 | RogueTournRoomTypeElite RogueTournRoomType = 2
9 | RogueTournRoomTypeBattle RogueTournRoomType = 3
10 | RogueTournRoomTypeEncounter RogueTournRoomType = 4
11 | RogueTournRoomTypeEvent RogueTournRoomType = 5
12 | RogueTournRoomTypeCoin RogueTournRoomType = 6
13 | RogueTournRoomTypeShop RogueTournRoomType = 7
14 | RogueTournRoomTypeReward RogueTournRoomType = 8
15 | RogueTournRoomTypeAdventure RogueTournRoomType = 9
16 | RogueTournRoomTypeRespite RogueTournRoomType = 10
17 | RogueTournRoomTypeReforge RogueTournRoomType = 11
18 | RogueTournRoomTypeHidden RogueTournRoomType = 12
19 | )
20 |
21 | type RogueBuffCategory = string
22 |
23 | const (
24 | RogueBuffCategoryNone RogueBuffCategory = ""
25 | RogueBuffCategoryCommon RogueBuffCategory = "Common"
26 | RogueBuffCategoryRare RogueBuffCategory = "Rare"
27 | RogueBuffCategoryLegendary RogueBuffCategory = "Legendary"
28 | )
29 |
30 | type RogueBuffAeonType = string
31 |
32 | const (
33 | RogueBuffAeonTypeNormal RogueBuffAeonType = ""
34 | RogueBuffAeonTypeBattleEventBuff RogueBuffAeonType = "BattleEventBuff"
35 | RogueBuffAeonTypeBattleEventBuffEnhance RogueBuffAeonType = "BattleEventBuffEnhance"
36 | RogueBuffAeonTypeBattleEventBuffCross RogueBuffAeonType = "BattleEventBuffCross"
37 | )
38 |
--------------------------------------------------------------------------------
/pkg/constant/skill_action.go:
--------------------------------------------------------------------------------
1 | package constant
2 |
3 | type SkillAction int
4 |
5 | const (
6 | AddMazeBuff SkillAction = 1
7 | AddTeamPlayerHP SkillAction = 2
8 | AddTeamPlayerSp SkillAction = 3
9 | SetMonsterDie SkillAction = 4
10 | SummonUnit SkillAction = 5
11 | )
12 |
--------------------------------------------------------------------------------
/pkg/constant/train_party.go:
--------------------------------------------------------------------------------
1 | package constant
2 |
3 | type TrainPartyCardType string
4 |
5 | const (
6 | TrainPartyCardTypeTrainPartyCardTypeNone TrainPartyCardType = ""
7 | TrainPartyCardTypeAddPassengerStat TrainPartyCardType = "AddPassengerStat"
8 | TrainPartyCardTypeAddPassengerMemory TrainPartyCardType = "AddPassengerMemory"
9 | TrainPartyCardTypeAddPassengerMood TrainPartyCardType = "AddPassengerMood"
10 | TrainPartyCardTypeRecoverPamStamina TrainPartyCardType = "RecoverPamStamina"
11 | )
12 |
--------------------------------------------------------------------------------
/pkg/database/conf.go:
--------------------------------------------------------------------------------
1 | package database
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/pkg/constant"
5 | "gorm.io/gorm"
6 | )
7 |
8 | // 拉取全部邮件
9 | func GetDbAllMail(db *gorm.DB) []*constant.Mail {
10 | var mailMap []*constant.Mail
11 | db.Find(&mailMap)
12 | return mailMap
13 | }
14 |
15 | // 拉取全部模拟宇宙
16 | func GetAllRogue(db *gorm.DB) []*constant.RogueConf {
17 | var rogueMap []*constant.RogueConf
18 | db.Find(&rogueMap)
19 | return rogueMap
20 | }
21 |
22 | // 拉取区服配置
23 | func GetRegionConf(db *gorm.DB, regionName string) (*constant.RegionConf, error) {
24 | var regionConf *constant.RegionConf
25 | err := db.Model(&constant.RegionConf{}).Where("name = ?", regionName).First(®ionConf).Error
26 | if err != nil {
27 | return nil, err
28 | }
29 | return regionConf, nil
30 | }
31 |
32 | // 拉取全部区服配置
33 | func GetAllRegionConf(db *gorm.DB) []*constant.RegionConf {
34 | var regionConfList []*constant.RegionConf
35 | db.Find(®ionConfList)
36 | return regionConfList
37 | }
38 |
39 | // 设置区服数据
40 | func SetRegionConf(db *gorm.DB, regionConf *constant.RegionConf) error {
41 | err := db.Model(&constant.RegionConf{}).Where("name = ?", regionConf.Name).Updates(regionConf).Error
42 | return err
43 | }
44 |
--------------------------------------------------------------------------------
/pkg/database/push.go:
--------------------------------------------------------------------------------
1 | package database
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/pkg/constant"
5 | "github.com/gucooing/hkrpg-go/pkg/logger"
6 | "gorm.io/gorm"
7 | )
8 |
9 | func NewPush(db *gorm.DB) {
10 | db.AutoMigrate(
11 | &constant.ServiceLog{}, // log
12 | )
13 | logger.Info("数据库连接成功")
14 | }
15 |
--------------------------------------------------------------------------------
/pkg/endec/endec_test.go:
--------------------------------------------------------------------------------
1 | package endec
2 |
3 | import (
4 | "encoding/base64"
5 | "fmt"
6 | "testing"
7 | )
8 |
9 | var key []byte
10 |
11 | func init() {
12 | key, _ = base64.StdEncoding.DecodeString("NK6Ucg8hCXN9oPZFojqcAqYEY2DETZzt6oKrGmZwdOU=")
13 | }
14 |
15 | func TestAesCBC(t *testing.T) {
16 | raw := []byte("fuck")
17 | enc, _ := AesCBCEncrypt(raw, key, key[0:16])
18 | fmt.Printf("enc: %v\n", enc)
19 | dec, _ := AesCBCDecrypt(enc, key, key[0:16])
20 | fmt.Printf("dec: %v\n", dec)
21 | }
22 |
23 | func TestAesCFB(t *testing.T) {
24 | raw := []byte("fuck")
25 | enc, _ := AesCFBEncrypt(raw, key, key[0:16])
26 | fmt.Printf("enc: %v\n", enc)
27 | dec, _ := AesCFBDecrypt(enc, key, key[0:16])
28 | fmt.Printf("dec: %v\n", dec)
29 | }
30 |
31 | func TestHk4eAbilityHashCode(t *testing.T) {
32 | hashCode := Hk4eAbilityHashCode("Avatar_Ayato_ExtraAttack")
33 | fmt.Printf("Avatar_Ayato_ExtraAttack hashCode: %v\n", hashCode)
34 | hashCode = Hk4eAbilityHashCode("Avatar_Ayato_ExtraAttack_CreateBullet")
35 | fmt.Printf("Avatar_Ayato_ExtraAttack_CreateBullet hashCode: %v\n", hashCode)
36 | }
37 |
--------------------------------------------------------------------------------
/pkg/kcp/udp_socket_darwin.go:
--------------------------------------------------------------------------------
1 | //go:build darwin
2 | // +build darwin
3 |
4 | package kcp
5 |
6 | import (
7 | "golang.org/x/net/ipv4"
8 | )
9 |
10 | func (s *UDPSession) rx() {
11 | s.defaultRx()
12 | }
13 |
14 | func (l *Listener) rx() {
15 | l.defaultRx()
16 | }
17 |
18 | func (s *UDPSession) tx(txqueue []ipv4.Message) {
19 | s.defaultTx(txqueue)
20 | }
21 |
22 | func (l *Listener) SendEnetNotifyToPeer(enet *Enet) {
23 | l.defaultSendEnetNotifyToPeer(enet)
24 | }
25 |
26 | func (s *UDPSession) SendEnetNotifyToPeer(enet *Enet) {
27 | s.defaultSendEnetNotifyToPeer(enet)
28 | }
29 |
--------------------------------------------------------------------------------
/pkg/kcp/udp_socket_windows.go:
--------------------------------------------------------------------------------
1 | //go:build windows
2 | // +build windows
3 |
4 | package kcp
5 |
6 | import (
7 | "golang.org/x/net/ipv4"
8 | )
9 |
10 | func (s *UDPSession) rx() {
11 | s.defaultRx()
12 | }
13 |
14 | func (l *Listener) rx() {
15 | l.defaultRx()
16 | }
17 |
18 | func (s *UDPSession) tx(txqueue []ipv4.Message) {
19 | s.defaultTx(txqueue)
20 | }
21 |
22 | func (l *Listener) SendEnetNotifyToPeer(enet *Enet) {
23 | l.defaultSendEnetNotifyToPeer(enet)
24 | }
25 |
26 | func (s *UDPSession) SendEnetNotifyToPeer(enet *Enet) {
27 | s.defaultSendEnetNotifyToPeer(enet)
28 | }
29 |
--------------------------------------------------------------------------------
/pkg/logger/logger_linux.go:
--------------------------------------------------------------------------------
1 | //go:build linux
2 | // +build linux
3 |
4 | package logger
5 |
6 | import (
7 | "strconv"
8 |
9 | "golang.org/x/sys/unix"
10 | )
11 |
12 | func (l *Logger) getThreadId() (threadId string) {
13 | tid := unix.Gettid()
14 | threadId = strconv.Itoa(tid)
15 | return threadId
16 | }
17 |
--------------------------------------------------------------------------------
/pkg/logger/logger_windows.go:
--------------------------------------------------------------------------------
1 | //go:build !linux
2 | // +build !linux
3 |
4 | package logger
5 |
6 | import (
7 | "strconv"
8 |
9 | "golang.org/x/sys/windows"
10 | )
11 |
12 | func (l *Logger) getThreadId() (threadId string) {
13 | tid := windows.GetCurrentThreadId()
14 | threadId = strconv.Itoa(int(tid))
15 | return threadId
16 | }
17 |
--------------------------------------------------------------------------------
/pkg/mq/topic.go:
--------------------------------------------------------------------------------
1 | package mq
2 |
3 | import (
4 | "errors"
5 |
6 | spb "github.com/gucooing/hkrpg-go/protocol/server/proto"
7 | )
8 |
9 | func (m *MessageQueue) SendToGate(appid uint32, msg *NetMsg) {
10 | msg.ServerType = spb.ServerType_SERVICE_GATE
11 | msg.AppId = appid
12 | msg.OriginServerAppId = m.appId
13 | msg.OriginServerType = m.serverType
14 | m.netMsgInput <- msg
15 | }
16 |
17 | func (m *MessageQueue) SendToGame(appid uint32, msg *NetMsg) {
18 | msg.ServerType = spb.ServerType_SERVICE_GAME
19 | msg.AppId = appid
20 | msg.OriginServerAppId = m.appId
21 | msg.OriginServerType = m.serverType
22 | m.netMsgInput <- msg
23 | }
24 |
25 | func (m *MessageQueue) SendToNode(msg *NetMsg) error {
26 | if m.nodeTcp.state != nodeConnEct {
27 | return errors.New("node conn nil")
28 | }
29 | msg.ServerType = spb.ServerType_SERVICE_NODE
30 | msg.OriginServerAppId = m.appId
31 | msg.OriginServerType = m.serverType
32 | m.netMsgInput <- msg
33 | return nil
34 | }
35 |
--------------------------------------------------------------------------------
/pkg/push/build.go:
--------------------------------------------------------------------------------
1 | package push
2 |
3 | const AppVersion = "0.0.1"
4 |
--------------------------------------------------------------------------------
/pkg/push/client/nopush.go:
--------------------------------------------------------------------------------
1 | //go:build !push
2 | // +build !push
3 |
4 | package client
5 |
6 | import (
7 | "github.com/gucooing/hkrpg-go/pkg/constant"
8 | "github.com/gucooing/hkrpg-go/pkg/logger"
9 | "github.com/gucooing/hkrpg-go/pkg/text"
10 | )
11 |
12 | func NewPushClient(addr string) {
13 | logger.Info(text.GetText(5))
14 | }
15 |
16 | func PushServer(message constant.PushMessageAll) {}
17 |
--------------------------------------------------------------------------------
/pkg/push/server/README.md:
--------------------------------------------------------------------------------
1 | # PUSH 数据收集后端
2 |
3 | ## 示例:
4 |
5 | ### LOG:
6 | #### GET
7 |
--------------------------------------------------------------------------------
/pkg/push/server/config.go:
--------------------------------------------------------------------------------
1 | package server
2 |
3 | import (
4 | "encoding/json"
5 | "errors"
6 | "os"
7 | )
8 |
9 | type Config struct {
10 | LogLevel string `json:"LogLevel"`
11 | Db *Db `json:"Db"`
12 | Host string `json:"Host"`
13 | Port string `json:"Port"`
14 | Email *Email `json:"Email"`
15 | Webhooks *Webhooks `json:"Webhooks"`
16 | }
17 |
18 | type Db struct {
19 | Type string `json:"Type"`
20 | Host string `json:"Host"`
21 | }
22 |
23 | type Email struct {
24 | Is bool `json:"Is"`
25 | From string `json:"from"`
26 | Addr string `json:"addr"`
27 | Host string `json:"host"`
28 | Identity string `json:"identity"`
29 | }
30 |
31 | type Webhooks struct {
32 | Is bool `json:"Is"`
33 | Info string `json:"Info"`
34 | Error string `json:"Error"`
35 | }
36 |
37 | var CONF *Config = nil
38 |
39 | func GetConfig() *Config {
40 | return CONF
41 | }
42 |
43 | var FileNotExist = errors.New("config file not found")
44 |
45 | func LoadConfig(confName string) error {
46 | if _, err := os.Stat("./conf"); os.IsNotExist(err) {
47 | os.MkdirAll("./conf", 0644)
48 | }
49 | filePath := "./conf/" + confName
50 | f, err := os.Open(filePath)
51 | if err != nil {
52 | return FileNotExist
53 | }
54 | defer func() {
55 | _ = f.Close()
56 | }()
57 | c := new(Config)
58 | d := json.NewDecoder(f)
59 | if err := d.Decode(c); err != nil {
60 | return err
61 | }
62 | CONF = c
63 | return nil
64 | }
65 |
66 | var DefaultConfig = &Config{
67 | LogLevel: "info",
68 | Db: &Db{
69 | Type: "mysql",
70 | Host: "root:password@tcp(127.0.0.1:3306)/hkrpg-go-push?charset=utf8mb4&parseTime=True&loc=Local",
71 | },
72 | Host: "127.0.0.1",
73 | Port: "3000",
74 | Email: &Email{
75 | Is: false,
76 | From: "123456789@qq.com",
77 | Addr: "smtp.qq.com:587",
78 | Host: "smtp.qq.com",
79 | Identity: "123456789",
80 | },
81 | Webhooks: &Webhooks{
82 | Is: false,
83 | Info: "",
84 | Error: "",
85 | },
86 | }
87 |
--------------------------------------------------------------------------------
/pkg/push/server/log.go:
--------------------------------------------------------------------------------
1 | package server
2 |
3 | import (
4 | "fmt"
5 |
6 | "github.com/gin-gonic/gin"
7 | "github.com/gucooing/hkrpg-go/pkg/constant"
8 | "github.com/gucooing/hkrpg-go/pkg/logger"
9 | )
10 |
11 | func (s *Server) PushLog(c *gin.Context) {
12 | var log *constant.LogPush
13 | err := c.ShouldBindBodyWithJSON(&log)
14 | if err != nil {
15 | logger.Error("push log bind error: %s", err.Error())
16 | return
17 | }
18 | webHook := s.cfg.Webhooks
19 | if webHook.Is {
20 | var url string
21 | switch log.LogLevel {
22 | case constant.INFO:
23 | url = webHook.Info
24 | case constant.ERROR:
25 | url = webHook.Error
26 | default:
27 | logger.Error("push log bind error, invalid log level: %s", log.LogLevel)
28 | return
29 | }
30 | s.WebHooks(fmt.Sprintf("%s\n额外标签:%s\n%s",
31 | "*************************", log.Tag, log.LogMsg), url)
32 | }
33 | }
34 |
35 | func (s *Server) GetLog(c *gin.Context) {
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/pkg/push/server/router.go:
--------------------------------------------------------------------------------
1 | package server
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | )
6 |
7 | func (s *Server) initRouter() {
8 | s.router.POST("/", Default)
9 | // log
10 | s.router.GET("/log", s.GetLog) // 拉取 log
11 | s.router.POST("/log", s.PushLog) // 上传 log
12 | // 玩家运营数据
13 | }
14 |
15 | func Default(c *gin.Context) {
16 | if c.GetHeader("User-Agent") != "push" {
17 | c.JSON(404, gin.H{})
18 | return
19 | }
20 | c.Header("Push", "Push")
21 | c.JSON(200, gin.H{})
22 | }
23 |
--------------------------------------------------------------------------------
/pkg/push/server/server.go:
--------------------------------------------------------------------------------
1 | package server
2 |
3 | import (
4 | "context"
5 | "errors"
6 | "os"
7 | "time"
8 |
9 | "github.com/gin-gonic/gin"
10 | "github.com/gucooing/hkrpg-go/pkg/alg"
11 | "github.com/gucooing/hkrpg-go/pkg/constant"
12 | "github.com/gucooing/hkrpg-go/pkg/database"
13 | "github.com/gucooing/hkrpg-go/pkg/logger"
14 | "gorm.io/gorm"
15 | )
16 |
17 | type Server struct {
18 | db *gorm.DB
19 | router *gin.Engine
20 | cfg *Config
21 | }
22 |
23 | func NewServer(done chan os.Signal, cfg *Config) error {
24 | s := new(Server)
25 | s.cfg = cfg
26 | // new db
27 | db := cfg.Db
28 | switch db.Type {
29 | case "mysql":
30 | s.db = database.NewMysql(db.Host)
31 | case "sqlite":
32 | s.db = database.NewSqlite(db.Host)
33 | default:
34 | return errors.New("error db type:" + db.Type)
35 | }
36 | database.NewPush(s.db)
37 | // new http server
38 | gin.SetMode(gin.ReleaseMode)
39 | s.router = gin.Default() // gin.New()
40 | s.router.Use(gin.Recovery())
41 | s.initRouter()
42 |
43 | logger.Info("push server start!")
44 |
45 | go func() {
46 | err := alg.NewHttp(constant.AppNet{
47 | InnerAddr: cfg.Host,
48 | InnerPort: cfg.Port,
49 | OuterAddr: cfg.Host,
50 | OuterPort: cfg.Port,
51 | }, s.router)
52 | if err != nil {
53 | logger.Error(err.Error())
54 | return
55 | }
56 | }()
57 |
58 | select {
59 | case <-done:
60 | _, cancel := context.WithTimeout(context.Background(), 60*time.Second)
61 | defer cancel()
62 | logger.Info("push正在关闭")
63 | logger.Info("push已停止")
64 | logger.CloseLogger()
65 | return nil
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/pkg/push/server/webhook.go:
--------------------------------------------------------------------------------
1 | package server
2 |
3 | import (
4 | "github.com/go-resty/resty/v2"
5 | "github.com/gucooing/hkrpg-go/pkg/logger"
6 | )
7 |
8 | var WebhookClient *resty.Client
9 |
10 | type webHookBody struct {
11 | Content string `json:"content"`
12 | Username string `json:"username"`
13 | AvatarUrl string `json:"avatar_url"`
14 | }
15 |
16 | func getWebhook() *resty.Request {
17 | if WebhookClient == nil {
18 | WebhookClient = resty.New()
19 | }
20 | r := WebhookClient.R().
21 | SetHeader("Content-Type", "application/json")
22 | return r
23 | }
24 |
25 | func (s *Server) WebHooks(msg string, url string) {
26 | body := webHookBody{
27 | Content: msg,
28 | Username: "HkRpg-Push",
29 | AvatarUrl: "https://avatars.githubusercontent.com/u/90658478",
30 | }
31 | _, err := getWebhook().
32 | SetBody(body).
33 | Post(url)
34 | if err != nil {
35 | logger.Warn("webhooks消息发送错误:", err)
36 | }
37 | return
38 | }
39 |
--------------------------------------------------------------------------------
/pkg/random/random.go:
--------------------------------------------------------------------------------
1 | package random
2 |
3 | import (
4 | "encoding/hex"
5 | "math/rand"
6 | "time"
7 | )
8 |
9 | func GetTimeRand() *rand.Rand {
10 | return rand.New(rand.NewSource(time.Now().UnixNano()))
11 | }
12 |
13 | func GetRandomByte(len int) []byte {
14 | ret := make([]byte, 0)
15 | for i := 0; i < len; i++ {
16 | r := uint8(rand.Intn(256))
17 | ret = append(ret, r)
18 | }
19 | return ret
20 | }
21 |
22 | func GetRandomByteHexStr(len int) string {
23 | return hex.EncodeToString(GetRandomByte(len))
24 | }
25 |
--------------------------------------------------------------------------------
/pkg/rpc/client.go:
--------------------------------------------------------------------------------
1 | package rpc
2 |
3 | import (
4 | nodeapi "github.com/gucooing/hkrpg-go/nodeserver/api"
5 | "google.golang.org/grpc"
6 | )
7 |
8 | // node
9 | type NodeDiscoveryClient struct {
10 | nodeapi.NodeDiscoveryClient
11 | }
12 |
13 | func NewNodeRpcClient(grpcAddr string) (*NodeDiscoveryClient, error) {
14 | conn, err := grpc.NewClient(grpcAddr, grpc.WithInsecure())
15 | if err != nil {
16 | return nil, err
17 | }
18 | discoveryClient, err := newNodeDiscoveryClient(conn)
19 | if err != nil {
20 | return nil, err
21 | }
22 | return discoveryClient, nil
23 | }
24 |
25 | func newNodeDiscoveryClient(conn *grpc.ClientConn) (*NodeDiscoveryClient, error) {
26 | cl := nodeapi.NewNodeDiscoveryClient(conn)
27 | return &NodeDiscoveryClient{cl}, nil
28 | }
29 |
30 | // gm
31 |
--------------------------------------------------------------------------------
/pkg/sys/sys_darwin.go:
--------------------------------------------------------------------------------
1 | // +build darwin
2 |
3 | package sys
4 |
5 | import (
6 | "github.com/shirou/gopsutil/net"
7 | )
8 |
9 | func GetTCPCount() (int, error) {
10 | stats, err := net.Connections("tcp")
11 | if err != nil {
12 | return 0, err
13 | }
14 | return len(stats), nil
15 | }
16 |
17 | func GetUDPCount() (int, error) {
18 | stats, err := net.Connections("udp")
19 | if err != nil {
20 | return 0, err
21 | }
22 | return len(stats), nil
23 | }
24 |
--------------------------------------------------------------------------------
/pkg/sys/sys_linux.go:
--------------------------------------------------------------------------------
1 | //go:build linux
2 | // +build linux
3 |
4 | package sys
5 |
6 | import (
7 | "github.com/shirou/gopsutil/net"
8 | )
9 |
10 | func GetTCPCount() (int, error) {
11 | stats, err := net.Connections("tcp")
12 | if err != nil {
13 | return 0, err
14 | }
15 | return len(stats), nil
16 | }
17 |
18 | func GetUDPCount() (int, error) {
19 | stats, err := net.Connections("udp")
20 | if err != nil {
21 | return 0, err
22 | }
23 | return len(stats), nil
24 | }
25 |
--------------------------------------------------------------------------------
/pkg/sys/sys_windows.go:
--------------------------------------------------------------------------------
1 | //go:build windows
2 | // +build windows
3 |
4 | package sys
5 |
6 | import (
7 | "github.com/shirou/gopsutil/net"
8 | )
9 |
10 | func GetTCPCount() (int, error) {
11 | stats, err := net.Connections("tcp")
12 | if err != nil {
13 | return 0, err
14 | }
15 | return len(stats), nil
16 | }
17 |
18 | func GetUDPCount() (int, error) {
19 | stats, err := net.Connections("udp")
20 | if err != nil {
21 | return 0, err
22 | }
23 | return len(stats), nil
24 | }
25 |
--------------------------------------------------------------------------------
/protocol/build_proto.bat:
--------------------------------------------------------------------------------
1 | cd ./hkrpg
2 | protoc --proto_path=. --go_out=. *.proto
3 | cd ../server/proto
4 | protoc --proto_path=. --go_out=. *.proto
5 | cd ../../rpcapi
6 | protoc --proto_path=. --go_out=. *.proto
7 | protoc --go-grpc_out=. *.proto
8 |
--------------------------------------------------------------------------------
/protocol/build_server_proto.bat:
--------------------------------------------------------------------------------
1 | cd ./server/proto
2 | protoc --proto_path=. --go_out=. *.proto
3 | cd ../../rpcapi
4 | protoc --proto_path=. --go_out=. *.proto
5 | protoc --go-grpc_out=. *.proto
6 |
--------------------------------------------------------------------------------
/protocol/cmd/proto_endecode.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "log"
5 |
6 | "github.com/gucooing/hkrpg-go/pkg/alg"
7 | pb "google.golang.org/protobuf/proto"
8 | )
9 |
10 | type ProtoMsg struct {
11 | CmdId uint16
12 | PayloadMessage pb.Message
13 | }
14 |
15 | func DecodePayloadToProto(msg *alg.PackMsg) (protoObj pb.Message) {
16 | protoObj = GetSharedCmdProtoMap().GetProtoObjCacheByCmdId(msg.CmdId)
17 | if protoObj == nil {
18 | log.Println("get new proto object is nil")
19 | return nil
20 | }
21 | err := pb.Unmarshal(msg.ProtoData, protoObj)
22 | if err != nil {
23 | log.Printf("unmarshal proto data err: %v\n", err)
24 | return nil
25 | }
26 | return protoObj
27 | }
28 |
29 | func EncodeProtoToPayload(protoMsg *ProtoMsg) (serviceMsg *alg.PackMsg) {
30 | rspMsg := new(alg.PackMsg)
31 | var err error
32 | rspMsg.CmdId = protoMsg.CmdId
33 | rspMsg.ProtoData, err = pb.Marshal(protoMsg.PayloadMessage)
34 | if err != nil {
35 | log.Printf("pb marshal error: %v\n", err)
36 | }
37 | return rspMsg
38 | }
39 |
--------------------------------------------------------------------------------
/protocol/server/cmd_id.go:
--------------------------------------------------------------------------------
1 | package server
2 |
3 | import (
4 | spb "github.com/gucooing/hkrpg-go/protocol/server/proto"
5 | )
6 |
7 | const (
8 | GateTcpMqHandshakeReq = 10001
9 | GateTcpMqHandshakeRsp = 10002
10 | PlayerLogoutReq = 10003
11 | PlayerLogoutRsp = 10004
12 |
13 | PlayerLogoutNotify = 11001
14 | GmGive = 12001
15 | GmWorldLevel = 12002
16 | DelItem = 12003
17 | MaxCurAvatar = 12004
18 | GmMission = 12005
19 | )
20 |
21 | func (c *CmdProtoMap) registerAllMessage() {
22 | // seever
23 | c.regMsg(GateTcpMqHandshakeReq, func() any { return new(spb.GateTcpMqHandshakeReq) })
24 | c.regMsg(GateTcpMqHandshakeRsp, func() any { return new(spb.GateTcpMqHandshakeRsp) })
25 | c.regMsg(PlayerLogoutReq, func() any { return new(spb.PlayerLogoutReq) })
26 | c.regMsg(PlayerLogoutRsp, func() any { return new(spb.PlayerLogoutRsp) })
27 |
28 | c.regMsg(PlayerLogoutNotify, func() any { return new(spb.PlayerLogoutNotify) })
29 | c.regMsg(GmGive, func() any { return new(spb.GmGive) })
30 | c.regMsg(GmWorldLevel, func() any { return new(spb.GmWorldLevel) })
31 | c.regMsg(DelItem, func() any { return new(spb.DelItem) })
32 | c.regMsg(MaxCurAvatar, func() any { return new(spb.MaxCurAvatar) })
33 | c.regMsg(GmMission, func() any { return new(spb.GmMission) })
34 | }
35 |
--------------------------------------------------------------------------------
/protocol/server/proto/bin.server.handbook.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | package proto;
4 |
5 | option go_package = "./;proto";
6 |
7 | message Handbook {
8 | RogueHandbook rogue_handbook = 1; // 模拟宇宙handbook
9 | }
10 |
11 | /****************************模拟宇宙handbook***********************/
12 |
13 | message RogueHandbook {
14 | map miracle_info = 1; // 奇物
15 | map event_info = 2; // 事件
16 | map aeon_info = 3; // 星神
17 | map buff_list = 4; // buff
18 | }
19 |
20 | message RogueHandbookMiracleInfo {
21 | uint32 miracle_handbook_id = 1;
22 | bool is_taken_reward = 2;
23 | }
24 |
25 | message RogueHandbookEventInfo {
26 | uint32 event_handbook_id = 1;
27 | bool is_taken_reward = 2;
28 | }
29 |
30 | message RogueHandbookAeonInfo {
31 | uint32 rogue_aeon_id = 1;
32 | map unlock_aeon_story_map = 2;
33 | }
--------------------------------------------------------------------------------
/protocol/server/proto/cmd.server.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | package proto;
4 |
5 | option go_package = "./;proto";
6 |
7 | import "enum.server.proto";
8 |
9 | message GateTcpMqHandshakeReq {
10 | ServerType type = 1; // 服务类型
11 | uint32 app_id = 2; // app_id
12 | }
13 |
14 | message GateTcpMqHandshakeRsp {
15 | Retcode ret_code = 1; // 状态
16 | ServerType type = 2; // 服务类型
17 | uint32 app_id = 3; // app_id
18 | }
19 |
20 | message PlayerLogoutReq {
21 | uint32 uid = 1; // uid
22 | uint32 gate_app_id = 2; // 源gate
23 | LOGOUTSTATUS status = 3; //离线原因
24 | }
25 |
26 | message PlayerLogoutRsp {
27 | uint32 uid = 1; // uid
28 | uint32 gate_app_id = 2; // 源gate
29 | LOGOUTSTATUS status = 3; //离线原因
30 | }
31 |
32 | message PlayerLogoutNotify{ // 玩家下线通知
33 | uint32 uid= 1;
34 | LOGOUTSTATUS status = 2; //离线原因
35 | }
--------------------------------------------------------------------------------
/protocol/server/proto/common.server.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | option go_package = "./;proto";
4 |
5 | message CommAndReq {
6 |
7 | }
8 |
9 | message CommAndRsp {
10 |
11 | }
12 |
13 | message GmGive {
14 | uint32 player_uid = 1;
15 | uint32 item_id = 2;
16 | uint32 item_count = 3;
17 | bool give_all = 4;
18 | }
19 |
20 | message GmWorldLevel {
21 | uint32 player_uid = 1;
22 | uint32 world_level = 2;
23 | }
24 |
25 | message DelItem {
26 | uint32 player_uid = 1;
27 | }
28 |
29 | message MaxCurAvatar{
30 | uint32 player_uid = 1;
31 | uint32 avatar_id = 2;
32 | bool all = 3;
33 | }
34 |
35 | message GmMission {
36 | uint32 player_uid = 1;
37 | bool finish_all = 2;
38 | uint32 mission_id = 3;
39 | }
--------------------------------------------------------------------------------
/protocol/server/proto_endecode.go:
--------------------------------------------------------------------------------
1 | package server
2 |
3 | import (
4 | "log"
5 |
6 | "github.com/gucooing/hkrpg-go/pkg/alg"
7 | pb "google.golang.org/protobuf/proto"
8 | )
9 |
10 | type ProtoMsg struct {
11 | CmdId uint16
12 | PayloadMessage pb.Message
13 | }
14 |
15 | func DecodePayloadToProto(msg *alg.PackMsg) (protoObj pb.Message) {
16 | protoObj = GetSharedCmdProtoMap().GetProtoObjCacheByCmdId(msg.CmdId)
17 | if protoObj == nil {
18 | log.Println("get new proto object is nil")
19 | return nil
20 | }
21 | err := pb.Unmarshal(msg.ProtoData, protoObj)
22 | if err != nil {
23 | log.Printf("unmarshal proto data err: %v\n", err)
24 | return nil
25 | }
26 | return protoObj
27 | }
28 |
29 | func EncodeProtoToPayload(protoMsg *ProtoMsg) (protoData []byte) {
30 | protoData, err := pb.Marshal(protoMsg.PayloadMessage)
31 | if err != nil {
32 | log.Printf("pb marshal error: %v\n", err)
33 | return nil
34 | }
35 | return protoData
36 | }
37 |
--------------------------------------------------------------------------------
/robot/config/config.go:
--------------------------------------------------------------------------------
1 | package config
2 |
3 | import (
4 | "encoding/json"
5 | "errors"
6 | "os"
7 | )
8 |
9 | type Config struct {
10 | LogLevel string `json:"logLevel"`
11 | GameDataConfigPath string `toml:"gameDataConfigPath"`
12 | Server string `json:"server"`
13 | AccountName string `json:"accountName"`
14 | Amount int `json:"amount"`
15 | Conc int `json:"conc"`
16 | Dispatch string `json:"dispatch"`
17 | GateServer string `json:"gateServer"`
18 | }
19 |
20 | var CONF *Config = nil
21 |
22 | func GetConfig() *Config {
23 | return CONF
24 | }
25 |
26 | var FileNotExist = errors.New("config file not found")
27 |
28 | func LoadConfig(confName string) error {
29 | if _, err := os.Stat("./conf"); os.IsNotExist(err) {
30 | os.MkdirAll("./conf", 0644)
31 | }
32 | filePath := "./conf/" + confName
33 | f, err := os.Open(filePath)
34 | if err != nil {
35 | return FileNotExist
36 | }
37 | defer func() {
38 | _ = f.Close()
39 | }()
40 | c := new(Config)
41 | d := json.NewDecoder(f)
42 | if err := d.Decode(c); err != nil {
43 | return err
44 | }
45 | CONF = c
46 | return nil
47 | }
48 |
49 | var DefaultConfig = &Config{
50 | LogLevel: "Info",
51 | GameDataConfigPath: "resources",
52 | Server: "http://127.0.0.1:8080",
53 | AccountName: "HkRpgRoBotGo",
54 | Amount: 10,
55 | Conc: 10,
56 | Dispatch: "http://127.0.0.1:8080/query_dispatch?version=OSPRODWin1.5.0&t=114514&language_type=1&platform_type=3&channel_id=1&sub_channel_id=1&is_new_format=1",
57 | GateServer: "?version=OSPRODWin1.5.0&t=114514&uid=114514&language_type=1&platform_type=3&dispatch_seed=3a57430d8d&channel_id=1&sub_channel_id=1&is_need_url=1&account_type=1&account_uid=114514",
58 | }
59 |
--------------------------------------------------------------------------------
/robot/robot/game_scene.go:
--------------------------------------------------------------------------------
1 | package robot
2 |
3 | import (
4 | "math/rand"
5 | "time"
6 |
7 | "github.com/gucooing/hkrpg-go/gdconf"
8 | "github.com/gucooing/hkrpg-go/protocol/cmd"
9 | "github.com/gucooing/hkrpg-go/protocol/proto"
10 | )
11 |
12 | func (r *RoBot) GetCurSceneInfoScRsp(payloadMsg []byte) {
13 | msg := decodePayloadToProto(cmd.GetCurSceneInfoScRsp, payloadMsg)
14 | rsp := msg.(*proto.GetCurSceneInfoScRsp)
15 |
16 | r.Game.EntryId = rsp.Scene.EntryId
17 |
18 | for _, entityGroup := range rsp.Scene.EntityGroupList {
19 | for _, entity := range entityGroup.EntityList {
20 | if entity.EntityId == rsp.Scene.LeaderEntityId {
21 | r.Game.Rot = &Vector{
22 | X: entity.Motion.Pos.X,
23 | Y: entity.Motion.Pos.Y,
24 | Z: entity.Motion.Pos.Z,
25 | }
26 | r.Game.Pos = &Vector{
27 | X: entity.Motion.Rot.X,
28 | Y: entity.Motion.Rot.Y,
29 | Z: entity.Motion.Rot.Z,
30 | }
31 | break
32 | }
33 | }
34 | }
35 | }
36 |
37 | func (r *RoBot) EnterSceneCsReq() {
38 | if r.KcpConn == nil {
39 | return
40 | }
41 | entryIdList := gdconf.GetEntryIdList()
42 | rand.New(rand.NewSource(time.Now().UnixNano()))
43 | entryId := rand.Intn(len(entryIdList)-1) + 1
44 | rep := &proto.EnterSceneCsReq{
45 | EntryId: entryIdList[entryId],
46 | }
47 | r.send(cmd.EnterSceneCsReq, rep)
48 | }
49 |
50 | func (r *RoBot) EnterSceneByServerScNotify(payloadMsg []byte) {
51 | // r.EnterSceneCsReq()
52 | }
53 |
--------------------------------------------------------------------------------
/robot/robot/proto_endecode.go:
--------------------------------------------------------------------------------
1 | package robot
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/pkg/alg"
5 | "github.com/gucooing/hkrpg-go/pkg/logger"
6 | "github.com/gucooing/hkrpg-go/protocol/cmd"
7 | "google.golang.org/protobuf/encoding/protojson"
8 | pb "google.golang.org/protobuf/proto"
9 | )
10 |
11 | type ProtoMsg struct {
12 | CmdId uint16
13 | PayloadMessage pb.Message
14 | }
15 |
16 | func (r *RoBot) EncodeProtoToPayload(protoMsg *ProtoMsg) (kcpMsg *alg.PackMsg) {
17 | rspMsg := new(alg.PackMsg)
18 | var err error
19 | rspMsg.CmdId = protoMsg.CmdId
20 | rspMsg.ProtoData, err = pb.Marshal(protoMsg.PayloadMessage)
21 | if err != nil {
22 | logger.Debug("pb marshal error: %v", err)
23 | }
24 |
25 | // 打印需要的数据包
26 | data := protojson.Format(protoMsg.PayloadMessage)
27 | logger.Debug("[UID:%v] C --> S : CmdId: %v KcpMsg: \n%s\n", r.GameUid, protoMsg.CmdId, data)
28 |
29 | return rspMsg
30 | }
31 |
32 | func (r *RoBot) DecodePayloadToProto(msg *alg.PackMsg) (protoObj pb.Message) {
33 | protoObj = cmd.GetSharedCmdProtoMap().GetProtoObjCacheByCmdId(msg.CmdId)
34 | if protoObj == nil {
35 | logger.Debug("get new proto object is nil")
36 | return nil
37 | }
38 | err := pb.Unmarshal(msg.ProtoData, protoObj)
39 | if err != nil {
40 | logger.Debug("unmarshal proto data err: %v", err)
41 | return nil
42 | }
43 |
44 | data := protojson.Format(protoObj)
45 | logger.Debug("[UID:%v] S --> C : NAME: %s KcpMsg: \n%s\n", r.GameUid, cmd.GetSharedCmdProtoMap().GetCmdNameByCmdId(msg.CmdId), data)
46 |
47 | return protoObj
48 | }
49 |
--------------------------------------------------------------------------------
/robot/robot/router.go:
--------------------------------------------------------------------------------
1 | package robot
2 |
3 | import (
4 | "github.com/gucooing/hkrpg-go/protocol/cmd"
5 | )
6 |
7 | func (r *RoBot) RegisterMessage(cmdId uint16, payloadMsg []byte) {
8 | switch cmdId {
9 | case cmd.PlayerLoginScRsp:
10 | go r.PlayerLoginScRsp()
11 | go r.PlayerHeartBeatCsReq()
12 | case cmd.PlayerHeartBeatScRsp:
13 | r.PlayerHeartbeatScRsp(payloadMsg)
14 | case cmd.GetCurSceneInfoScRsp:
15 | r.GetCurSceneInfoScRsp(payloadMsg)
16 | case cmd.EnterSceneByServerScNotify:
17 | r.EnterSceneByServerScNotify(payloadMsg)
18 | default:
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | FOLDER_NAME="resources"
4 | ZIP_URL="https://github.alsl.xyz/https://github.com/gucooing/hkrpg-go-Resources"
5 |
6 | if [ -d "$FOLDER_NAME" ]; then
7 | echo "目录 '$FOLDER_NAME' 已存在。"
8 | else
9 | echo "目录 '$FOLDER_NAME' 不存在,正在下载并解压..."
10 | git clone --depth=1 $ZIP_URL resources
11 | echo "资源已下载并解压到 '$FOLDER_NAME'。"
12 | fi
13 |
14 | echo "RUN hkrpg-go"
15 | ./hkrpg-go
--------------------------------------------------------------------------------
/suppl/discord/command/binding.go:
--------------------------------------------------------------------------------
1 | package command
2 |
3 | import (
4 | "github.com/bwmarrin/discordgo"
5 | "github.com/gucooing/hkrpg-go/pkg/logger"
6 | )
7 |
8 | func (c *Command) bindingCommand() {
9 | c.Commands["bind"] = func(s *discordgo.Session, i *discordgo.InteractionCreate) {
10 | options := i.ApplicationCommandData().Options
11 | optionMap := make(map[string]*discordgo.ApplicationCommandInteractionDataOption, len(options))
12 | for _, opt := range options {
13 | optionMap[opt.Name] = opt
14 | }
15 | response := "绑定玩家"
16 | if option, ok := optionMap["uid"]; ok {
17 | response += option.StringValue()
18 | }
19 | err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
20 | Type: discordgo.InteractionResponseChannelMessageWithSource,
21 | Data: &discordgo.InteractionResponseData{
22 | Content: response,
23 | },
24 | })
25 | if err != nil {
26 | logger.Error("绑定玩家错误:", err)
27 | return
28 | }
29 | }
30 | // c.bindingApplication()
31 | }
32 |
33 | func (c *Command) bindingApplication() {
34 | cmd, err := c.ApplicationCommandCreate(c.State.User.ID, "", &discordgo.ApplicationCommand{
35 | Name: "bind",
36 | Description: "绑定玩家",
37 | Options: []*discordgo.ApplicationCommandOption{
38 | {
39 | Type: discordgo.ApplicationCommandOptionString,
40 | Name: "uid",
41 | Required: true,
42 | Description: "你游戏里面的uid",
43 | },
44 | },
45 | })
46 | if err != nil {
47 |
48 | }
49 | c.Cmds = append(c.Cmds, cmd)
50 | }
51 |
--------------------------------------------------------------------------------
/suppl/discord/command/command.go:
--------------------------------------------------------------------------------
1 | package command
2 |
3 | import (
4 | "github.com/bwmarrin/discordgo"
5 | )
6 |
7 | type CommandFunc func(s *discordgo.Session, i *discordgo.InteractionCreate)
8 |
9 | type Command struct {
10 | *discordgo.Session
11 | Commands map[string]CommandFunc
12 | Cmds []*discordgo.ApplicationCommand
13 | }
14 |
15 | func InitCommands(s *discordgo.Session) *Command {
16 | c := &Command{
17 | Session: s,
18 | Commands: make(map[string]CommandFunc),
19 | Cmds: make([]*discordgo.ApplicationCommand, 0),
20 | }
21 | c.infoCommand()
22 | c.bindingCommand()
23 |
24 | return c
25 | }
26 |
27 | func (c *Command) Application() {
28 | c.infoApplication()
29 | c.bindingApplication()
30 | }
31 |
--------------------------------------------------------------------------------
/suppl/discord/command/info.go:
--------------------------------------------------------------------------------
1 | package command
2 |
3 | import (
4 | "github.com/bwmarrin/discordgo"
5 | hkrpg_go_pe "github.com/gucooing/hkrpg-go/hkrpg-go-pe"
6 | "github.com/gucooing/hkrpg-go/pkg/logger"
7 | )
8 |
9 | func (c *Command) infoCommand() {
10 | c.Commands["info"] = func(s *discordgo.Session, i *discordgo.InteractionCreate) {
11 | response := hkrpg_go_pe.GetServerInfo()
12 | err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
13 | Type: discordgo.InteractionResponseChannelMessageWithSource,
14 | Data: &discordgo.InteractionResponseData{
15 | Content: response,
16 | },
17 | })
18 | if err != nil {
19 | logger.Error("获取服务器状态错误:", err)
20 | return
21 | }
22 | }
23 | // c.infoApplication()
24 | }
25 |
26 | func (c *Command) infoApplication() {
27 | cmd, err := c.ApplicationCommandCreate(c.State.User.ID, "", &discordgo.ApplicationCommand{
28 | Name: "info",
29 | Description: "获取服务器状态",
30 | })
31 | if err != nil {
32 |
33 | }
34 | c.Cmds = append(c.Cmds, cmd)
35 | }
36 |
--------------------------------------------------------------------------------
/suppl/discord/config.go:
--------------------------------------------------------------------------------
1 | package discord
2 |
3 | import (
4 | "encoding/json"
5 | "errors"
6 | "os"
7 | )
8 |
9 | type Config struct {
10 | Type string `json:"type"`
11 | Token string `json:"token"`
12 | Db *Db `json:"db"`
13 | }
14 | type Db struct {
15 | Type string `json:"type"`
16 | Dns string `json:"dns"`
17 | }
18 |
19 | var conf *Config = nil
20 |
21 | func getConfig() *Config {
22 | return conf
23 | }
24 |
25 | var FileNotExist = errors.New("config file not found")
26 |
27 | func loadConfig(confName string) error {
28 | if _, err := os.Stat("./conf"); os.IsNotExist(err) {
29 | os.MkdirAll("./conf", 0644)
30 | }
31 | filePath := "./conf/" + confName
32 | f, err := os.Open(filePath)
33 | if err != nil {
34 | return FileNotExist
35 | }
36 | defer func() {
37 | _ = f.Close()
38 | }()
39 | c := new(Config)
40 | d := json.NewDecoder(f)
41 | if err := d.Decode(c); err != nil {
42 | return err
43 | }
44 | conf = c
45 | return nil
46 | }
47 |
--------------------------------------------------------------------------------
/suppl/discord/discord.go:
--------------------------------------------------------------------------------
1 | package discord
2 |
3 | import (
4 | "sync"
5 |
6 | "github.com/bwmarrin/discordgo"
7 | "github.com/gucooing/hkrpg-go/pkg/database"
8 | "github.com/gucooing/hkrpg-go/pkg/logger"
9 | "github.com/gucooing/hkrpg-go/suppl/discord/command"
10 | )
11 |
12 | var Once sync.Once
13 |
14 | type Bot struct {
15 | *discordgo.Session
16 | }
17 |
18 | func Start() {
19 | logger.Info("DiscordBot Start")
20 | err := loadConfig("discord.json")
21 | if err != nil {
22 | logger.Error("Load Discord config error: %s", err)
23 | return
24 | }
25 | b := new(Bot)
26 | cfg := getConfig()
27 | database.NewDiscord(cfg.Db.Type, cfg.Db.Dns)
28 | b.Session, err = discordgo.New(cfg.Type + " " + cfg.Token)
29 | if err != nil {
30 | logger.Error("Discord Bot error: %s", err)
31 | return
32 | }
33 | b.LogLevel = discordgo.LogDebug
34 | c := command.InitCommands(b.Session)
35 | b.AddHandler(func(s *discordgo.Session, i *discordgo.InteractionCreate) {
36 | if h, ok := c.Commands[i.ApplicationCommandData().Name]; ok {
37 | h(s, i)
38 | }
39 | })
40 | err = b.Open()
41 | if err != nil {
42 | logger.Error("Open Discord Bot error: %s", err)
43 | return
44 | }
45 | c.Application()
46 |
47 | select {}
48 | }
49 |
--------------------------------------------------------------------------------
/suppl/suppl.go:
--------------------------------------------------------------------------------
1 | package suppl
2 |
3 | import (
4 | "flag"
5 |
6 | "github.com/gucooing/hkrpg-go/suppl/discord"
7 | )
8 |
9 | func Start() {
10 | discordFlag := flag.Bool("discord", false, "Start Discord Bot")
11 | flag.Parse()
12 | if *discordFlag {
13 | discord.Once.Do(func() {
14 | go discord.Start()
15 | })
16 | }
17 | // go pushc.NewPushClient()
18 | }
19 |
--------------------------------------------------------------------------------
/tools/android/install.sh:
--------------------------------------------------------------------------------
1 | mkdir hkrpg
2 | chmod 777 ./hkrpg
3 | cd ./hkrpg
4 | mkdir conf
5 | chmod 777 ./conf
6 | cd ./conf
7 | wget https://oss.mihoyu.cn/hkrpg/2.5.0/server/hkrpg-go-pe.json
8 | cd ../
9 | mkdir resources
10 | cd ./resources
11 | wget https://oss.mihoyu.cn/hkrpg/2.5.0/server/resources.zip
12 | unzip resources.zip
13 | cd ../
14 | chmod 777 ./resources
15 | mkdir data
16 | cd ./data
17 | wget https://oss.mihoyu.cn/hkrpg/2.5.0/server/data.zip
18 | unzip data.zip
19 | cd ../
20 | chmod 777 ./data
21 | wget https://oss.mihoyu.cn/hkrpg/2.5.0/server/linux-arm64/hkrpg-go
22 | chmod 777 ./hkrpg-go
--------------------------------------------------------------------------------
/tools/rebirth/README.md:
--------------------------------------------------------------------------------
1 | [EN](/docs/rebirth/zh-CN.md) | [简中](/docs/rebirth/zh-CN.md) | [繁中](/docs/rebirth/zh-CN.md) | [JP](/docs/rebirth/zh-CN.md) | [RU](/docs/rebirth/zh-CN.md) | [FR](/docs/rebirth/zh-CN.md) | [KR](/docs/rebirth/zh-CN.md) | [VI](/docs/rebirth/zh-CN.md)
2 |
3 | ## REBIRTH
4 | ### 将你的官服存档导入私人服务器
5 |
6 | ### 支持的导入内容
7 | - **背包**
8 | - **编队**
9 | - **角色**
10 |
11 | ### 计划支持的导入内容
12 | - **邮件**
13 | - **剧情**
14 |
15 | ### 如何导入私人服务器
16 |
17 | - **hkrpg-go**:
18 | ___
19 |
20 | - **LunarCore**:暂不支持
21 | ___
22 |
23 | - **DanhengServer**:暂不支持
24 |
--------------------------------------------------------------------------------
/唐/唐璃.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gucooing/hkrpg-go/ef47e49a233133c46d70ab5a4deb4bc71ae49571/唐/唐璃.png
--------------------------------------------------------------------------------
/唐/唐璃2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gucooing/hkrpg-go/ef47e49a233133c46d70ab5a4deb4bc71ae49571/唐/唐璃2.png
--------------------------------------------------------------------------------