Initial commit

This commit is contained in:
Naruse
2024-11-07 23:25:15 +08:00
commit e8e5f3a1a7
246 changed files with 27356 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

6
.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
/.vscode
*.pyc
/resources
/game_server/packet/test
/lib/proto

15
Config.json Normal file
View File

@@ -0,0 +1,15 @@
{
"LogLevel": "INFO",
"MaxSessions": 10,
"GameServer": {
"Ip": "127.0.0.1",
"Port": 16100
},
"SdkServer": {
"Ip": "127.0.0.1",
"Port": 80
},
"VerboseLevel":1,
"RegionName":"MikuBH3",
"UseLocalCache":false
}

3
Endless.json Normal file
View File

@@ -0,0 +1,3 @@
{
"area1":781009
}

97
README.md Normal file
View File

@@ -0,0 +1,97 @@
# MikuBH3
A Server emulator for version 7.9 of a certain adventure anime game
![screenshot](https://github.com/MikuLeaks/MikuBH3-PS/blob/master/screenshot.png)
## Requirements
- Python 3.12++
- [MongoDB](https://www.mongodb.com/try/download/community)
## Features
- Basic features: inventory,warship,dress,custom team
- Working battle with grandkey & elf/astral
- Superstring Dimension (Abyss)
- Universial Mirage
- Story Chapter 1 - 42
## Installation
For your first launch, run these:
```python
pip install -r requirements.txt
```
Download resources & proto from [MikuBH3-Res](https://github.com/MikuLeaks/MikuBH3-RES) and place them into your resources & lib folder.
```
├───resources
│ └───ExcelOutputAsset
├───lib
│ └───proto
│ └───__init__.py
```
also build patch from [MikuBH3-Patch](https://github.com/MikuLeaks/MikuBH3-PATCH) and place them into your game directory `Honkai Impact 3rd Game`
## To-Do List
- Commands
- Memorial Arena
- Elysian Realm
- Open World
- Part 2 Story & Open world
- Character Tutorial
### Connecting with the client (Fiddler method)
- Log in with the client to an official server at least once to download game data.
- Install and have [Fiddler Classic](https://www.telerik.com/fiddler) running.
- Copy and paste the following code into the Fiddlerscript tab of Fiddler Classic. Remember to save the fiddler script after you copy and paste it:
```
import System;
import System.Windows.Forms;
import Fiddler;
import System.Text.RegularExpressions;
class Handlers
{
static function OnBeforeRequest(oS: Session) {
if( (oS.host.EndsWith("global1.bh3.com")) || oS.host == "47.74.175.126" || oS.host.EndsWith(".yuanshen.com") || oS.host.EndsWith(".hoyoverse.com") || oS.host.EndsWith(".starrails.com") || oS.host.EndsWith(".bhsr.com") || oS.host.EndsWith(".kurogame.com") || oS.host.EndsWith(".zenlesszonezero.com") || oS.host.EndsWith(".g3.proletariat.com") || oS.host.EndsWith("west.honkaiimpact3.com") || oS.host.EndsWith("westglobal01.honkaiimpact3.com") || oS.host.EndsWith(".os.honkaiimpact3.com") || oS.host.EndsWith("overseas01-appsflyer-report.honkaiimpact3.com") || oS.host.EndsWith(".mihoyo.com") || (oS.host.EndsWith("global2.bh3.com") && !oS.host.Contains("bundle"))) {
oS.host = "127.0.0.1";
}
}
}
```
## Usage/Examples
To run the project use cmd or vscode and run
```python
py hi3
```
after game running wait for 20-30 seconds till patch loaded and press Try Again
![Patch](https://github.com/MikuLeaks/MikuBH3-PS/blob/master/patch.png)
till it look like this
## Change Stage Superstring Dimension (Abyss)
edit `Endless.json` and set area1 to desire `SiteID` from `UltraEndlessSite.json`
## Use Local Patch
edit `Config.json` and set UseLocalCache to True, after that put data cache folder from AppData `Honkai Impact 3rd Game` into `resources/statics`
# Support
Join [Discord](discord.gg/MdHC4AJvec) for support
# Credits
- am25

93
database/__init__.py Normal file
View File

@@ -0,0 +1,93 @@
from __future__ import annotations
import pymongo
from database.create_db import MongoDBCreate
from database.save_data import SaveData
from game_server.resource import ResourceManager
class MongoDBConnection:
def __init__(self, host="localhost", port=27017, db_name="mikubh3"):
self.host = host
self.port = port
self.db_name = db_name
self.client = None
self.db = None
def connect(self):
try:
ResourceManager.instance().load_resources()
self.client = pymongo.MongoClient(f"mongodb://{self.host}:{self.port}/")
if self.db_name:
self.db = self.client[self.db_name]
databases = self.client.list_database_names()
if self.db_name not in databases:
print("Database not found. Will create one")
MongoDBCreate(self)
print("Connected to MongoDB successfully!")
else:
print("No database selected.")
except pymongo.errors.ConnectionFailure as e:
print("Could not connect to MongoDB: %s" % e)
def close(self):
if self.client:
self.client.close()
print("Connection to MongoDB closed.")
def get_collection(self, collection_name):
if self.db is not None:
return self.db[collection_name]
else:
print("No database selected. Connect to a database first.")
return None
def insert_document(self, collection_name, document):
collection = self.get_collection(collection_name)
if collection is not None:
try:
result = collection.insert_one(document)
print(f"Document inserted successfully with id:{result.inserted_id}")
except Exception as e:
print(f"Error inserting document:{e}")
def find_documents(self, collection_name, query={}):
collection = self.get_collection(collection_name)
if collection is not None:
return collection.find(query)
else:
print("Collection not found.")
return None
def find_documents_by_key_values(self, collection_name, key_values):
collection = self.get_collection(collection_name)
if collection is not None:
query = {key: value for key, value in key_values.items()}
return collection.find(query)
else:
print("Collection not found.")
return None
def update_document(self, collection_name, filter_query, update_query):
collection = self.get_collection(collection_name)
if collection is not None:
try:
result = collection.update_one(filter_query, update_query)
print(f"Document updated successfully:{result.modified_count}")
except Exception as e:
print(f"Error updating document:{e}")
def delete_document(self, collection_name, filter_query):
collection = self.get_collection(collection_name)
if collection is not None:
try:
result = collection.delete_one(filter_query)
print(f"Document deleted successfully:{result.deleted_count} document(s) deleted.")
except Exception as e:
print(f"Error deleting document:{e}")
def save(self,session,data_type,ids=[0]):
save_data = SaveData(self,session,data_type,ids)
save_data.save()
mongo = MongoDBConnection()
mongo.connect()

169
database/create_db.py Normal file
View File

@@ -0,0 +1,169 @@
import time
import json
import random
from game_server.resource import ResourceManager
from game_server.resource.configdb.avatar_data import AvatarData
from game_server.resource.configdb.weapon_data import WeaponData
from game_server.resource.configdb.stigmata_data import StigmataData
from game_server.resource.configdb.material_data import MaterialData
from game_server.resource.configdb.elf_astra_mate_data import ElfAstraMateData
from game_server.resource.configdb.dress_data import DressData
from game_server.game.enum.item_type import MainType
class MongoDBCreate:
def __init__(self, mongo):
self.mongo = mongo
self.manager = ResourceManager.instance()
self.create_db()
self.avatars()
self.items()
self.elfs()
def create_db(self):
player_data = {
"UID": 1337,
"Name": "Miku",
"Level": 88,
"Exp": 0,
"HCoin": 1337,
"Stamina": 80,
"Sign": "MikuPS",
"HeadPhoto": 161090,
"HeadFrame": 200001,
"WarshipId": 400004,
"AssistantAvatarId": 101,
"WarshipAvatar": {
"WarshipFirstAvatarId": 101,
"WarshipSecondAvatarId": 0
},
"BirthDate": 0,
"CustomAvatarTeamList":{
f"{i}":{
"TeamId":i,
"Name": f"Team {i}",
"astraMateId":0,
"isUsingAstraMate":False,
"elfIdList":[],
"AvatarIdLists":[]
}
for i in range(1,11)
}
}
self.mongo.insert_document("players",player_data)
def avatars(self):
data = []
for avatar in self.manager.instance().values(AvatarData):
valk = {
"AvatarID":avatar.avatarID,
"Star":avatar.unlockStar,
"Level":80,
"Exp":0,
"Fragment":0,
"TouchGoodFeel":0,
"TodayHasAddGoodFeel":0,
"DressID":avatar.DefaultDressId,
"DressLists":[
dress.dressID
for dress in self.manager.instance().values(DressData)
if avatar.avatarID in dress.avatarIDList
],
"AvatarArtifact":None,
"SubStar":0,
"SkillLists": {
f"{skillId}": {
"SkillId": skillId,
"SubSkillLists": {}
}
for skillId in avatar.skillList
},
"CreateTime":int(time.time())
}
data.append(valk)
self.mongo.get_collection("avatars").insert_many(data)
def items(self):
last_item = self.mongo.get_collection("items").find_one(sort=[("UniqueID", -1)])
unique_id = last_item["UniqueID"] + 1 if last_item else 1
items_data = []
for weapon in self.manager.instance().values(WeaponData):
if weapon.rarity == weapon.maxRarity:
weapon_data = {
"UniqueID":unique_id,
"ItemID":weapon.ID,
"Level":weapon.maxLv,
"Exp":0,
"IsLocked":False,
"IsExtracted":False,
"QuantumBranchLists":None,
"MainType":MainType.WEAPON.value,
"EquipAvatarID":0
}
items_data.append(weapon_data)
unique_id += 1
for stigmata in self.manager.instance().values(StigmataData):
if stigmata.rarity == stigmata.maxRarity:
stigmata_data = {
"UniqueID":unique_id,
"ItemID":stigmata.ID,
"Level":stigmata.maxLv,
"Exp":0,
"SlotNum":0,
"RefineValue":0,
"PromoteTimes":0,
"IsLocked":False,
"RuneLists":[],
"WaitSelectRuneLists":[],
"WaitSelectRuneGroupLists":[],
"MainType":MainType.STIGMATA.value,
"EquipAvatarID":0
}
items_data.append(stigmata_data)
unique_id += 1
for material in self.manager.instance().values(MaterialData):
material = {
"ItemID":material.ID,
"ItemNum":99999999 if material.ID == 100 else (999 if material.quantityLimit > 999 else material.quantityLimit),
"MainType":MainType.MATERIAL.value,
}
items_data.append(material)
for avatar in self.manager.instance().values(AvatarData):
avatar_data = {
"UniqueID":unique_id,
"ItemID":avatar.initialWeapon,
"Level":15,
"Exp":0,
"IsLocked":False,
"IsExtracted":False,
"QuantumBranchLists":None,
"MainType":MainType.WEAPON.value,
"EquipAvatarID":avatar.avatarID
}
items_data.append(avatar_data)
unique_id += 1
self.mongo.get_collection("items").insert_many(items_data)
def elfs(self):
elfs_data = []
for elf in self.manager.instance().values(ElfAstraMateData):
elf_data = {
"ElfId":elf.ElfID,
"Level":elf.MaxLevel,
"Star":elf.MaxRarity,
"Exp":0,
"SkillLists":{
f"{skill.ElfSkillID}":{
"SkillId":skill.ElfSkillID,
"Level":skill.MaxLv
}
for skill in elf.skill_lists
}
}
elfs_data.append(elf_data)
self.mongo.get_collection("elfs").insert_many(elfs_data)

130
database/save_data.py Normal file
View File

@@ -0,0 +1,130 @@
from game_server.game.enum.data_type import DataType
class SaveData:
def __init__(self, mongo, session, data_type:DataType, ids: list):
self.mongo = mongo
self.session = session
self.data_type = data_type
self.ids = ids
def save(self):
data_type_handlers = {
DataType.MATERIAL: self._save_material,
DataType.WEAPON: self._save_weapon,
DataType.STIGMATA: self._save_stigmata,
DataType.AVATAR: self._save_avatar,
DataType.PLAYER: self._save_player
}
handler = data_type_handlers.get(self.data_type)
if handler:
handler()
else:
raise ValueError(f"Unsupported data type: {self.data_type}")
def _save_material(self):
for id in self.ids:
get_item = self.session.player.inventory.material_items.get(id)
if get_item:
filter = {"ItemID": get_item.item_id}
update = {"$set": {"Num": get_item.num}}
self.mongo.update_document("items",filter,update)
def _save_weapon(self):
for unique_id in self.ids:
if id == 0:
continue
get_item = self.session.player.inventory.weapon_items.get(unique_id)
if get_item:
filter = {"UniqueID": unique_id}
update = {
"$set":
{
"Level": get_item.level,
"Exp": get_item.exp,
"IsLocked" : get_item.is_locked,
"IsExtracted" : get_item.is_extracted,
"EquipAvatarID" : get_item.equip_avatar_id
}
}
self.mongo.update_document("items",filter,update)
def _save_stigmata(self):
for unique_id in self.ids:
if id == 0:
continue
get_item = self.session.player.inventory.stigmata_items.get(unique_id)
if get_item:
filter = {"UniqueID": unique_id}
update = {
"$set":
{
"Level": get_item.level,
"Exp": get_item.exp,
"SlotNum": get_item.slot_num,
"IsLocked" : get_item.is_locked,
"EquipAvatarID" : get_item.equip_avatar_id
}
}
self.mongo.update_document("items",filter,update)
def _save_avatar(self):
for id in self.ids:
avatar = self.session.player.avatars.get(id)
if avatar:
filter = {"AvatarID": id}
update = {
"$set":
{
"Star": avatar.star,
"Fragment": avatar.fragment,
"TouchGoodFeel" : avatar.touch_good_feel,
"TodayHasAddGoodFeel" : avatar.today_has_add_good_feel,
"DressID" : avatar.dress_id,
"SkillLists" : {
f"{skill_id}":{
"SkillId":skill.skill_id,
"SubSkillLists":{
f"{sub_skill.sub_skill_id}":{
"subSkillId":sub_skill.sub_skill_id,
"level":sub_skill.level
}
for sub_id, sub_skill in skill.sub_skill_lists.items()
}
}
for skill_id,skill in avatar.skill_lists.items()
},
}
}
self.mongo.update_document("avatars",filter,update)
def _save_player(self):
filter = {"UID": self.session.player.uid}
update = {
"$set":
{
"Name": self.session.player.name,
"HCoin": self.session.player.hcoin,
"Sign": self.session.player.signature,
"HeadPhoto": self.session.player.head_photo,
"HeadFrame": self.session.player.head_frame,
"WarshipId": self.session.player.warship_id,
"AssistantAvatarId": self.session.player.assistant_avatar_id,
"WarshipAvatar":{
"WarshipFirstAvatarId": self.session.player.warship_avatar.warship_first_avatar_id,
"WarshipSecondAvatarId": self.session.player.warship_avatar.warship_second_avatar_id
},
"BirthDate":self.session.player.birth_date,
"CustomAvatarTeamList":{
f"{team_id}":{
"TeamId":team_id,
"Name": team.name,
"astraMateId":team.astral_mate_id,
"isUsingAstraMate":team.is_using_astra_mate,
"elfIdList":team.elf_id_list,
"AvatarIdLists":team.avatar_id_list
}
for team_id,team in self.session.player.custom_avatar_team_list.items()
}
}
}
self.mongo.update_document("players",filter,update)

5
game_server/__init__.py Normal file
View File

@@ -0,0 +1,5 @@
from game_server.net.gateway import Gateway
class GameServer:
def main(self, ServerIp, GameServerPort):
Gateway(ServerIp, GameServerPort)

View File

@@ -0,0 +1,57 @@
# 头文件, 负责统一引用外部库
# 本文件夹下的文件禁止引用此文件
import os
import sys
import json
import time
import zlib
import base64
import socket
import struct
import logging
import requests
import threading
from dynaconf import Dynaconf
from flask import Flask, request, jsonify, send_from_directory, Blueprint
from pathlib import Path
from enum import Enum
from .config import *
from .log import * # TODO: After config to tempfix config.json not found error
from lib import proto as protos
from pprint import pprint
import importlib
import re
__all__ = [
"os",
"sys",
"json",
"time",
"zlib",
"base64",
"socket",
"struct",
"logging",
"threading",
"Dynaconf",
"Flask",
"request",
"requests",
"jsonify",
"send_from_directory",
"Blueprint",
"Path",
"Enum",
"Log",
"Error",
"Warn",
"Info",
"Debug",
"Config",
"Root",
"protos",
"pprint",
"importlib",
"re"
]

View File

@@ -0,0 +1,42 @@
import os
import json
from dynaconf import Dynaconf
# 此处设置默认值
Root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ConfigData = {
"LogLevel": "INFO",
"MaxSessions": 10,
"GameServer": {
"Ip": "127.0.0.1",
"Port": 16100
},
"SdkServer": {
"Ip": "127.0.0.1",
"Port": 80
},
"VerboseLevel":1,
"RegionName":"MikuBH3",
"UseLocalCache":False
}
class ConfigInit:
def __init__(self):
self.ConfigPath = f"{Root}/../Config.json"
self.ConfigData = self.Load()
if not os.path.exists(self.ConfigPath):
with open(self.ConfigPath, 'w') as f:
json.dump(ConfigData, f, indent=4)
def Load(self):
Settings = Dynaconf(
settings_files = [self.ConfigPath],
default_settings = ConfigData
)
return Settings
def Get(self):
return self.ConfigData
Config = ConfigInit().Load()

37
game_server/config/log.py Normal file
View File

@@ -0,0 +1,37 @@
import json
import sys
from loguru import logger
# Configuration for the logger
logger.remove()
with open("Config.json", "r", encoding="utf-8") as f:
LogLevel = json.load(f)["LogLevel"]
LevelList = ["ERROR", "WARNING", "INFO", "DEBUG"]
CodeColorDict = {
"ERROR": "red",
"WARNING": "yellow",
"INFO": "green",
"DEBUG": "blue"
}
def custom_format(record):
color = CodeColorDict[record["level"].name]
return f"<{color}>{record['level'].name}</{color}> : {record['message']}\n"
logger.add(sys.stdout, format=custom_format, colorize=True, level=LogLevel)
def Log(msg, types):
if types in CodeColorDict and LevelList.index(types) <= LevelList.index(LogLevel):
getattr(logger, types.lower())(msg)
def Error(msg):
Log(msg, "ERROR")
def Warn(msg):
Log(msg, "WARNING")
def Info(msg):
Log(msg, "INFO")
def Debug(msg):
Log(msg, "DEBUG")

View File

@@ -0,0 +1,33 @@
import dataclasses
from typing import List
from lib.proto import AvatarSubSkill
@dataclasses.dataclass
class Skill:
skill_id : int
sub_skill_lists : dict[int, AvatarSubSkill] = dataclasses.field(default_factory=dict)
@dataclasses.dataclass
class AvatarManager:
avatar_id: int
star: int
level: int
exp: int
fragment: List
touch_good_feel: List
today_has_add_good_feel: int
dress_id: int
dress_lists: List
sub_star: int
skill_lists: dict[int, Skill]
weapon_id: int = 0
stigmata_ids: dict = dataclasses.field(default_factory=dict)
@dataclasses.dataclass
class AvatarTeamManager:
team_id: int
name: str
astral_mate_id: int
is_using_astra_mate: bool
elf_id_list: List
avatar_id_list: List

View File

@@ -0,0 +1,16 @@
import dataclasses
from typing import List
@dataclasses.dataclass
class ElfSkill:
skill_id: int
level: int
@dataclasses.dataclass
class ElfManager:
elf_id: int
level: int
star: int
exp: 0
skill_list: dict[int,ElfSkill] = dataclasses.field(default_factory=dict)

View File

@@ -0,0 +1,8 @@
from enum import Enum
class DataType(Enum):
MATERIAL = 1
WEAPON = 2
STIGMATA = 3
AVATAR = 4
PLAYER = 5

View File

@@ -0,0 +1,6 @@
from enum import Enum
class MainType(Enum):
MATERIAL = 1
WEAPON = 2
STIGMATA = 3

View File

@@ -0,0 +1,32 @@
import dataclasses
@dataclasses.dataclass
class Material:
item_id : int
num : int
@dataclasses.dataclass
class Weapon:
item_id : int
level : int
exp : int
is_locked : bool
is_extracted : bool
equip_avatar_id: int
@dataclasses.dataclass
class Stigmata:
item_id : int
level : int
exp : int
slot_num : int
refine_value : int
promote_times : int
is_locked : bool
equip_avatar_id : int
@dataclasses.dataclass
class InventoryManager:
material_items : dict[int,Material] = dataclasses.field(default_factory=dict)
weapon_items : dict[int,Weapon] = dataclasses.field(default_factory=dict)
stigmata_items : dict[int,Stigmata] = dataclasses.field(default_factory=dict)

View File

@@ -0,0 +1,131 @@
import dataclasses
from database import mongo
from game_server.game.avatar.avatar_manager import AvatarManager,Skill,AvatarSubSkill,AvatarTeamManager
from game_server.game.inventory.inventory_manager import InventoryManager,Material,Weapon,Stigmata
from game_server.game.elf.elf_manager import ElfManager,ElfSkill
from game_server.game.enum.item_type import MainType
@dataclasses.dataclass
class WarshipAvatar:
warship_first_avatar_id: int
warship_second_avatar_id: int
@dataclasses.dataclass
class Player:
uid: int
name: str
level: int
exp: int
hcoin: int
stamina: int
signature: str
head_photo: int
head_frame: int
warship_id: int
assistant_avatar_id: int
birth_date: int
warship_avatar: WarshipAvatar
# Player managers
avatars: dict[int, AvatarManager] = dataclasses.field(default_factory=dict)
inventory: InventoryManager = dataclasses.field(default_factory=InventoryManager)
elfs: dict[int,ElfManager] = dataclasses.field(default_factory=dict)
custom_avatar_team_list: dict[int,AvatarTeamManager] = dataclasses.field(default_factory=dict)
def init_default(self):
self.add_all_avatar()
self.add_all_items()
self.add_all_elfs()
def add_all_avatar(self):
avatars = mongo.find_documents("avatars")
for avatar in avatars:
data = AvatarManager(
avatar_id=avatar['AvatarID'],
star=avatar['Star'],
level=avatar['Level'],
exp=avatar['Exp'],
fragment=avatar['Fragment'],
touch_good_feel=avatar['TouchGoodFeel'],
today_has_add_good_feel=avatar['TodayHasAddGoodFeel'],
dress_id=avatar['DressID'],
dress_lists=avatar['DressLists'],
sub_star=avatar['SubStar'],
skill_lists={
skill['SkillId']:
Skill(
skill_id=skill['SkillId'],
sub_skill_lists={
sub_skill['subSkillId']:
AvatarSubSkill(
sub_skill_id=sub_skill['subSkillId'],
level=sub_skill['level']
)
for sub_id,sub_skill in skill['SubSkillLists'].items()
}
)
for id,skill in avatar['SkillLists'].items()
}
)
weapon = list(mongo.find_documents_by_key_values("items", {"EquipAvatarID": avatar['AvatarID'], "MainType":MainType.WEAPON.value}))
stigmata = list(mongo.find_documents_by_key_values("items", {"EquipAvatarID": avatar['AvatarID'], "MainType":MainType.STIGMATA.value}))
if any(weapon):
data.weapon_id = weapon[0]['UniqueID']
if any(stigmata):
for stigma in stigmata:
data.stigmata_ids[stigma['SlotNum']] = stigma['UniqueID']
self.avatars[avatar['AvatarID']] = data
def add_all_items(self):
get_items = mongo.find_documents("items")
for item in get_items:
if item['MainType'] == MainType.MATERIAL.value:
normal_item = Material(
item_id=item['ItemID'],
num=item['ItemNum']
)
self.inventory.material_items[item['ItemID']] = normal_item
if item['MainType'] == MainType.WEAPON.value:
weapon = Weapon(
item_id=item['ItemID'],
level=item['Level'],
exp=item['Exp'],
is_locked=item['IsLocked'],
is_extracted=item['IsExtracted'],
equip_avatar_id=item['EquipAvatarID']
)
self.inventory.weapon_items[item['UniqueID']] = weapon
if item['MainType'] == MainType.STIGMATA.value:
stigmata = Stigmata(
item_id=item['ItemID'],
level=item['Level'],
exp=item['Exp'],
slot_num=item['SlotNum'],
refine_value=item['RefineValue'],
promote_times=item['PromoteTimes'],
is_locked=item['IsLocked'],
equip_avatar_id=item['EquipAvatarID']
)
self.inventory.stigmata_items[item['UniqueID']] = stigmata
def add_all_elfs(self):
get_elfs = mongo.find_documents("elfs")
for elf in get_elfs:
data = ElfManager(
elf_id=elf['ElfId'],
level=elf['Level'],
star=elf['Star'],
exp=elf['Exp'],
skill_list={
skill['SkillId']:
ElfSkill(
skill_id=skill['SkillId'],
level=skill['Level']
)
for id,skill in elf['SkillLists'].items()
}
)
self.elfs[elf['ElfId']] = data

View File

@@ -0,0 +1,25 @@
from game_server.config.log import Info
from game_server.net.session import Session
import asyncio
class Gateway:
def __init__(self, server_ip, game_server_port) -> None:
self.server_ip = server_ip
self.game_server_port = game_server_port
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)
try:
self.loop.run_until_complete(self.start_server())
finally:
self.loop.run_until_complete(self.loop.shutdown_asyncgens())
self.loop.close()
async def start_server(self):
session = Session()
server = await asyncio.start_server(session.handle_connection, self.server_ip, self.game_server_port)
Info("Gateway listening...")
async with server:
await server.serve_forever()

41
game_server/net/packet.py Normal file
View File

@@ -0,0 +1,41 @@
import struct
from game_server.protocol.cmd_id import CmdID
class Packet:
def __init__(self, buf: bytes):
self.raw = buf
self.head_magic = buf[:4]
self.user_id = struct.unpack('>I', buf[12:16])[0]
self.cmd_id = struct.unpack('>I', buf[24:28])[0]
self.header_len = struct.unpack('>H', buf[28:30])[0]
self.body_len = struct.unpack('>I', buf[30:34])[0]
self.body = buf[34 + self.header_len:34 + self.header_len + self.body_len]
self.tail_magic = buf[-4:]
@staticmethod
def send_packet(body):
cmdid = CmdID[body.__class__.__name__]
data = body.SerializeToString()
buf = bytearray(38 + len(data))
struct.pack_into('>I', buf, 0, 0x01234567)
struct.pack_into('>H', buf, 4, 1)
struct.pack_into('>H', buf, 6, 0)
struct.pack_into('>I', buf, 8, 0)
struct.pack_into('>I', buf, 12, 0)
struct.pack_into('>I', buf, 16, 0)
struct.pack_into('>I', buf, 20, 0)
struct.pack_into('>I', buf, 24, cmdid)
struct.pack_into('>H', buf, 28, 0)
struct.pack_into('>I', buf, 30, len(data))
buf[34:34 + len(data)] = data
struct.pack_into('>I', buf, 34 + len(data), 0x89ABCDEF)
return Packet(bytes(buf))

153
game_server/net/session.py Normal file
View File

@@ -0,0 +1,153 @@
from game_server.config.log import Error, Info
from game_server.protocol.cmd_id import CmdID
from game_server.net.packet import Packet
from lib import proto as protos
import traceback
import betterproto
import importlib
import threading
import asyncio
from game_server.game.player import Player
class Session:
player : Player
def __init__(self) -> None:
self.writer = None
self.pending_notifies = []
asyncio.create_task(self.keep_alive_loop())
async def keep_alive_loop(self):
while self.writer is None:
await asyncio.sleep(1)
while True:
if self.writer.is_closing():
break
try:
await self.send(Packet.send_packet(protos.KeepAliveNotify()))
except Exception as ex:
Error(f"Error in KeepAliveLoop: {ex}")
break
await asyncio.sleep(3)
async def handle_connection(self, reader, writer):
self.writer = writer
addr = writer.get_extra_info('peername')
Info(f"Accepted connection from {addr}")
prefix = bytes([0x01, 0x23, 0x45, 0x67])
suffix = bytes([0x89, 0xAB, 0xCD, 0xEF])
try:
while True:
data = await reader.read(1 << 16)
if not data:
break
packets = []
message = memoryview(data)
offset = 0
while offset < len(message):
segment = message[offset:].tobytes()
start = segment.find(prefix)
if start == -1:
break
end = segment.find(suffix, start)
if end == -1:
break
end += len(suffix)
packets.append(segment[start:end])
offset += end
for packet in packets:
if self.is_valid_packet(packet):
processed_packet = Packet(packet)
await self.process_packet(processed_packet)
else:
Error(f"Invalid packet received: {packet.hex().upper()}")
except Exception as e:
Error(f"Exception in processing TCP: {e}")
finally:
writer.close()
await writer.wait_closed()
Info("Disconnected from protocol")
def create_packet(self, proto_message: betterproto.Message) -> Packet:
return Packet.send_packet(proto_message)
def is_valid_packet(self,data: bytes) -> bool:
hex_string = data.hex().upper()
return hex_string.startswith("01234567") and hex_string.endswith("89ABCDEF")
def pending_notify(self, proto_message: betterproto.Message):
packet = Packet.send_packet(proto_message)
self.pending_notifies.append(packet)
def send_pending_notifies_in_thread(self):
thread = threading.Thread(target=self._run_send_pending_notifies)
thread.start()
def _run_send_pending_notifies(self):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(self._send_pending_notifies())
loop.close()
async def _send_pending_notifies(self):
for packet in self.pending_notifies:
await self.send(packet)
self.pending_notifies.clear()
async def process_packet(self, packet : Packet):
if packet.cmd_id not in CmdID._value2member_map_:
Error(f"CmdId {packet.cmd_id} not recognized!")
return
request_name = CmdID(packet.cmd_id).name
if request_name == "KeepAliveNotify": return #await self.send(packet.send_packet(protos.KeepAliveNotify()))
try:
try:
req: betterproto.Message = getattr(protos, request_name)()
req.parse(packet.body)
except Exception:
req = betterproto.Message()
try:
Info(f"RECV packet: {request_name} ({packet.cmd_id})")
handle_module = importlib.import_module(f"game_server.packet.handlers.{request_name}")
handle_function = handle_module.handle
handle_result = await handle_function(self, req)
if not handle_result:
return
await self.send(packet.send_packet(handle_result))
self.send_pending_notifies_in_thread()
except ModuleNotFoundError:
Error(f"Unhandled request {request_name}")
return
except Exception as e:
Error(f"Handler {request_name} returned error: {e}")
traceback.print_exc()
return
except Exception:
Error("Packet processing failed. Traceback: ")
traceback.print_exc()
return
async def send(self, packet: Packet):
if packet.cmd_id not in CmdID._value2member_map_:
Error(f"CmdId {packet.cmd_id} not recognized!")
return
packet_name = CmdID(packet.cmd_id).name
try:
self.writer.write(packet.raw)
await self.writer.drain()
Info(f"Sent packet: {packet_name} ({packet.cmd_id})")
except Exception as ex:
Error(f"Failed to send {packet_name}: {ex}")
traceback.print_exc()

View File

@@ -0,0 +1,10 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
AddCustomAvatarTeamReq,
AddCustomAvatarTeamRsp
)
async def handle(session: Session, msg: AddCustomAvatarTeamReq) -> betterproto.Message:
return AddCustomAvatarTeamRsp(retcode=0)

View File

@@ -0,0 +1,7 @@
import betterproto
from game_server.net.session import Session
from lib.proto import AddGoodfeelReq,AddGoodfeelRsp
async def handle(session: Session, msg: AddGoodfeelReq) -> betterproto.Message:
return AddGoodfeelRsp(retcode=0)

View File

@@ -0,0 +1,7 @@
import betterproto
from game_server.net.session import Session
from lib.proto import ArkPlusActivityGetDataReq,ArkPlusActivityGetDataRsp
async def handle(session: Session, msg: ArkPlusActivityGetDataReq) -> betterproto.Message:
return ArkPlusActivityGetDataRsp(retcode=0)

View File

@@ -0,0 +1,60 @@
import betterproto
from game_server.net.session import Session
from game_server.game.enum.data_type import DataType
from game_server.resource import ResourceManager
from game_server.resource.configdb.avatar_sub_skill_data import AvatarSubSkillData
from database import mongo
from lib.proto import (
AvatarSubSkillLevelUpReq,
AvatarSubSkillLevelUpRsp,
AvatarSubSkill,
GetAvatarDataReq,
GetEquipmentDataRsp,
Material
)
async def handle(session: Session, msg: AvatarSubSkillLevelUpReq) -> betterproto.Message:
avatar_data = session.player.avatars.get(msg.avatar_id)
if not avatar_data:
return AvatarSubSkillLevelUpRsp(retcode=2)
skill_data = avatar_data.skill_lists.get(msg.skill_id)
if not skill_data:
return AvatarSubSkillLevelUpRsp(retcode=3)
sub_skill_data = ResourceManager.instance().find_by_index(AvatarSubSkillData, msg.sub_skill_id)
if not sub_skill_data:
return AvatarSubSkillLevelUpRsp(retcode=4)
sub_skill = skill_data.sub_skill_lists.get(msg.sub_skill_id)
if not sub_skill:
skill_data.sub_skill_lists[msg.sub_skill_id] = AvatarSubSkill(
sub_skill_id=msg.sub_skill_id,
level=0
)
current_level = skill_data.sub_skill_lists[msg.sub_skill_id].level
new_level = sub_skill_data.maxLv if msg.is_level_up_all else current_level + 1
if new_level > sub_skill_data.maxLv:
return AvatarSubSkillLevelUpRsp(retcode=10)
skill_data.sub_skill_lists[msg.sub_skill_id] = AvatarSubSkill(
sub_skill_id=msg.sub_skill_id,
level=new_level
)
avatar_data.skill_lists[msg.skill_id] = skill_data
await session.process_packet(session.create_packet(GetAvatarDataReq(avatar_id_list=[msg.avatar_id])))
coin = session.player.inventory.material_items.get(100)
if coin:
session.pending_notify(
GetEquipmentDataRsp(
material_list=[Material(id=coin.item_id, num=coin.num)]
)
)
mongo.save(session, DataType.AVATAR, [msg.avatar_id])
return AvatarSubSkillLevelUpRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import BuffAssistGetActivityReq,BuffAssistGetActivityRsp
async def handle(session: Session, msg: BuffAssistGetActivityReq) -> betterproto.Message:
return BuffAssistGetActivityRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import BwWorldCampActivityGetDataReq, BwWorldCampActivityGetDataRsp
async def handle(session: Session, msg: BwWorldCampActivityGetDataReq) -> betterproto.Message:
return BwWorldCampActivityGetDataRsp(retcode=0)

View File

@@ -0,0 +1,37 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
ChapterArkGetDataReq,
ChapterArkGetDataRsp,
ChapterArk,
ChapterArkRoleInfo,
ChapterArkSkillInfo,
ChapterArkSupSkillInfo
)
async def handle(session: Session, msg: ChapterArkGetDataReq) -> betterproto.Message:
avatar_lists = [1,2,3,4,5]
return ChapterArkGetDataRsp(
retcode=0,
chapter_ark=ChapterArk(
chapter_id=msg.chapter_id,
avatar_list=avatar_lists,
is_finish_opening=True,
role_list=[
ChapterArkRoleInfo(
id=id,
level=30
)
for id in avatar_lists
],
skill_list=[
ChapterArkSkillInfo(
id=i * 100 + j,
level=3 if j > 3 else 1
)
for i in range(1, 6)
for j in range(1, 13)
]
)
)

View File

@@ -0,0 +1,17 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
ChapterBwWorldGetDataReq,
ChapterBwWorldGetDataRsp,
ChapterBwWorld,
ChapterBwWorldRune,
ChapterBwWorldTowerStage
)
async def handle(session: Session, msg: ChapterBwWorldGetDataReq) -> betterproto.Message:
return ChapterBwWorldGetDataRsp(
retcode=0,
chapter_bw_world=ChapterBwWorld(
chapter_id=msg.chapter_id
)
)

View File

@@ -0,0 +1,314 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
ChapterGroupGetDataReq,
ChapterGroupGetDataRsp,
ChapterGroup,
ChapterGroupSite,
ChapterGroupSiteStatus
)
async def handle(session: Session, msg: ChapterGroupGetDataReq) -> betterproto.Message:
rsp = ChapterGroupGetDataRsp(
retcode=0,
is_all=True,
chapter_group_list=[
ChapterGroup(
id=1,
site_list=[
ChapterGroupSite(
chapter_id=1,
site_id=1,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=2,
site_id=2,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=2,
site_list=[
ChapterGroupSite(
chapter_id=3,
site_id=3,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=4,
site_id=4,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=5,
site_id=5,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=6,
site_id=6,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=3,
site_list=[
ChapterGroupSite(
chapter_id=7,
site_id=7,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=8,
site_id=8,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=9,
site_id=9,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=10,
site_id=10,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=11,
site_id=11,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=4,
site_list=[
ChapterGroupSite(
chapter_id=12,
site_id=12,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=13,
site_id=13,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=14,
site_id=14,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=15,
site_id=15,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=5,
site_list=[
ChapterGroupSite(
chapter_id=16,
site_id=16,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=17,
site_id=17,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=6,
site_list=[
ChapterGroupSite(
chapter_id=18,
site_id=18,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=19,
site_id=19,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=20,
site_id=20,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=7,
site_list=[
ChapterGroupSite(
chapter_id=21,
site_id=21,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=22,
site_id=22,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=8,
site_list=[
ChapterGroupSite(
chapter_id=23,
site_id=23,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=24,
site_id=24,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=25,
site_id=25,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=9,
site_list=[
ChapterGroupSite(
chapter_id=26,
site_id=26,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=27,
site_id=27,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=28,
site_id=28,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=10,
site_list=[
ChapterGroupSite(
chapter_id=29,
site_id=29,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=30,
site_id=30,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=11,
site_list=[
ChapterGroupSite(
chapter_id=31,
site_id=31,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=12,
site_list=[
ChapterGroupSite(
chapter_id=32,
site_id=32,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=33,
site_id=33,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=34,
site_id=34,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_LOCKED.value
)
]
),
ChapterGroup(
id=13,
site_list=[
ChapterGroupSite(
chapter_id=36,
site_id=36,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
),
ChapterGroupSite(
chapter_id=37,
site_id=37,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=14,
site_list=[
ChapterGroupSite(
chapter_id=40,
site_id=40,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=15,
site_list=[
ChapterGroupSite(
chapter_id=43,
site_id=43,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=16,
site_list=[
ChapterGroupSite(
chapter_id=100,
site_id=100,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=17,
site_list=[
ChapterGroupSite(
chapter_id=150,
site_id=150,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
),
ChapterGroup(
id=18,
site_list=[
ChapterGroupSite(
chapter_id=200,
site_id=200,
status=ChapterGroupSiteStatus.CHAPTER_GROUP_SITE_STATUS_FINISHED.value
)
]
)
]
)
return rsp

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import ChapterKnightRichManGetDataReq, ChapterKnightRichManGetDataRsp
async def handle(session: Session, msg: ChapterKnightRichManGetDataReq) -> betterproto.Message:
return ChapterKnightRichManGetDataRsp(retcode=0,rich_man_id=101)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import ChatworldBeastGetActivityReq, ChatworldBeastGetActivityRsp
async def handle(session: Session, msg: ChatworldBeastGetActivityReq) -> betterproto.Message:
return ChatworldBeastGetActivityRsp(retcode=0)

View File

@@ -0,0 +1,9 @@
import betterproto
from game_server.net.session import Session
from lib.proto import ChatworldGetActivityScheduleReq, ChatworldGetActivityScheduleRsp
async def handle(session: Session, msg: ChatworldGetActivityScheduleReq) -> betterproto.Message:
return ChatworldGetActivityScheduleRsp(
retcode=0,
scene_id=111
)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import ChatworldGetPrayInfoReq, ChatworldGetPrayInfoRsp
async def handle(session: Session, msg: ChatworldGetPrayInfoReq) -> betterproto.Message:
return ChatworldGetPrayInfoRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import ClientReportReq,ClientReportRsp
async def handle(session: Session, msg: ClientReportReq) -> betterproto.Message:
return ClientReportRsp(retcode=0)

View File

@@ -0,0 +1,42 @@
import betterproto
from game_server.net.session import Session
from game_server.game.avatar.avatar_manager import AvatarTeamManager
from game_server.game.enum.data_type import DataType
from database import mongo
from lib.proto import (
DelCustomAvatarTeamReq,
DelCustomAvatarTeamRsp,
GetAvatarTeamDataRsp,
CustomAvatarTeam
)
async def handle(session: Session, msg: DelCustomAvatarTeamReq) -> betterproto.Message:
session.player.custom_avatar_team_list[msg.team_id] = AvatarTeamManager(
team_id=msg.team_id,
name=f"Team {msg.team_id}",
avatar_id_list=[],
elf_id_list=[],
astral_mate_id=0,
is_using_astra_mate=False
)
await session.send(session.create_packet(GetAvatarTeamDataRsp(
retcode=0,
custom_avatar_team_list=[
CustomAvatarTeam(
team_id=team.team_id,
name=team.name,
avatar_id_list=team.avatar_id_list,
elf_id_list=team.elf_id_list,
astra_mate_id=team.astral_mate_id,
is_using_astra_mate=team.is_using_astra_mate
)
for team_id,team in session.player.custom_avatar_team_list.items()
]
)))
mongo.save(session,DataType.PLAYER)
return DelCustomAvatarTeamRsp(retcode=0)

View File

@@ -0,0 +1,52 @@
import betterproto
from game_server.net.session import Session
from game_server.game.enum.data_type import DataType
from database import mongo
from lib.proto import (
DressEquipmentReq,
DressEquipmentRsp,
EquipmentSlot,
GetAvatarDataReq
)
async def handle(session: Session, msg: DressEquipmentReq) -> betterproto.Message:
avatar_data = session.player.avatars.get(msg.avatar_id)
if avatar_data:
replace_id = 0
match msg.slot:
case EquipmentSlot.EQUIPMENT_SLOT_WEAPON_1.value:
if avatar_data.weapon_id > 0:
replace_id = avatar_data.weapon_id
replace_weapon = session.player.inventory.weapon_items.get(avatar_data.weapon_id)
replace_weapon.equip_avatar_id = 0
avatar_data.weapon_id = msg.unique_id
weapon = session.player.inventory.weapon_items.get(msg.unique_id)
weapon.equip_avatar_id = msg.avatar_id
mongo.save(session,DataType.WEAPON,[msg.unique_id,replace_id])
case EquipmentSlot.EQUIPMENT_SLOT_STIGMATA_1.value | \
EquipmentSlot.EQUIPMENT_SLOT_STIGMATA_2.value | \
EquipmentSlot.EQUIPMENT_SLOT_STIGMATA_3.value:
slot_num = msg.slot-1
replace_id = avatar_data.stigmata_ids.get(slot_num,0)
if replace_id > 0:
replace_stigmata = session.player.inventory.stigmata_items.get(replace_id)
replace_stigmata.equip_avatar_id = 0
avatar_data.stigmata_ids[slot_num] = msg.unique_id
stigmata = session.player.inventory.stigmata_items.get(msg.unique_id)
stigmata.equip_avatar_id = msg.avatar_id
stigmata.slot_num = slot_num
mongo.save(session,DataType.STIGMATA,[msg.unique_id,replace_id])
await session.process_packet(session.create_packet(GetAvatarDataReq(avatar_id_list=[msg.avatar_id])))
return DressEquipmentRsp(
retcode=0,
unique_id=msg.unique_id,
slot=msg.slot
)

View File

@@ -0,0 +1,10 @@
import betterproto
from game_server.net.session import Session
from lib.proto import EnterWorldChatroomReq, EnterWorldChatroomRsp
async def handle(session: Session, msg: EnterWorldChatroomReq) -> betterproto.Message:
return EnterWorldChatroomRsp(
retcode=0,
chatroom_id=1,
player_num=69
)

View File

@@ -0,0 +1,13 @@
import betterproto
from game_server.net.session import Session
from lib.proto import FinishGuideReportReq,FinishGuideReportRsp
async def handle(session: Session, msg: FinishGuideReportReq) -> betterproto.Message:
print(msg.guide_id_list)
return FinishGuideReportRsp(
retcode=0,
guide_id_list=msg.guide_id_list,
is_finish=True
)

View File

@@ -0,0 +1,22 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GeneralActivityGetMainInfoReq,
GeneralActivityGetMainInfoRsp,
GeneralActivity,
GeneralActivityBasicInfo
)
async def handle(session: Session, msg: GeneralActivityGetMainInfoReq) -> betterproto.Message:
return GeneralActivityGetMainInfoRsp(
retcode=0,
activity_list=[
GeneralActivity(
general_basic_info=GeneralActivityBasicInfo(
activity_id=50000001,
schedule_id=412,
series_activity_id=[50000001]
)
)
]
)

View File

@@ -0,0 +1,40 @@
import betterproto
from game_server.net.session import Session
from game_server.resource import ResourceManager
from game_server.resource.configdb.avatar_tutorial import AvatarTutorialData
from game_server.resource.configdb.activity_tower import ActivityTowerData
from game_server.utils import get_unix_in_seconds
from lib.proto import (
GeneralActivityGetScheduleReq,
GeneralActivityGetScheduleRsp,
GeneralActivityScheduleInfo
)
async def handle(session: Session, msg: GeneralActivityGetScheduleReq) -> betterproto.Message:
schedule_list = []
for tutorial in ResourceManager.instance().values(AvatarTutorialData):
schedule_list.append(
GeneralActivityScheduleInfo(
activity_id=tutorial.ActivityID,
settle_time=int(get_unix_in_seconds()+3600*24*7),
end_time=int(get_unix_in_seconds()+3600*24*7),
end_day_time=int(get_unix_in_seconds()+3600*24*7)
)
)
for tower in ResourceManager.instance().values(ActivityTowerData):
schedule_list.append(
GeneralActivityScheduleInfo(
activity_id=tower.ActivityID,
settle_time=int(get_unix_in_seconds()+3600*24*7),
end_time=int(get_unix_in_seconds()+3600*24*7),
end_day_time=int(get_unix_in_seconds()+3600*24*7)
)
)
return GeneralActivityGetScheduleRsp(
retcode=0,
schedule_list=schedule_list
)

View File

@@ -0,0 +1,9 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetActivityMainDataReq,GetActivityMainDataRsp
async def handle(session: Session, msg: GetActivityMainDataReq) -> betterproto.Message:
return GetActivityMainDataRsp(
retcode=0,
activity_module_type_list=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 72]
)

View File

@@ -0,0 +1,23 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetActivityRewardStatisticDataReq,
GetActivityRewardStatisticDataRsp,
ActivityRewardStatisticData,
ActivityRewardStatisticItemData
)
async def handle(session: Session, msg: GetActivityRewardStatisticDataReq) -> betterproto.Message:
return GetActivityRewardStatisticDataRsp(
retcode=0,
activity_reward_data=ActivityRewardStatisticData(
id=117,
item_data_list=[
ActivityRewardStatisticItemData(
show_id=i
)
for i in range (506,509)
]
),
id=117
)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetAdventureGroupReq, GetAdventureGroupRsp
async def handle(session: Session, msg: GetAdventureGroupReq) -> betterproto.Message:
return GetAdventureGroupRsp(retcode=0)

View File

@@ -0,0 +1,44 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetAdventureStorySweepInfoReq,
GetAdventureStorySweepInfoRsp,
IslandStorySweepData
)
async def handle(session: Session, msg: GetAdventureStorySweepInfoReq) -> betterproto.Message:
return GetAdventureStorySweepInfoRsp(
retcode=0,
story_sweep_list=[
IslandStorySweepData(
avatar_id_list=[
20401,
20301,
20201
],
is_finished=True,
over_time=1719938652,
sweep_id=282
),
IslandStorySweepData(
avatar_id_list=[
3701,
3601,
3501
],
is_finished=True,
over_time=1719938654,
sweep_id=282
),
IslandStorySweepData(
avatar_id_list=[
3301,
3201,
3101
],
is_finished=True,
over_time=1719938655,
sweep_id=282
),
]
)

View File

@@ -0,0 +1,20 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetArmadaActivityListReq,
GetArmadaActivityListRsp,
ArmadaActivity,
ArmadaActivityType
)
async def handle(session: Session, msg: GetArmadaActivityListReq) -> betterproto.Message:
return GetArmadaActivityListRsp(
retcode=0,
activity_list=[
ArmadaActivity(
begin_time=0,
end_time=1880308800,
type=ArmadaActivityType.ARMADA_ACTIVITY_ARMADA_STAGE_SCORE_ACTIVITY.value
)
]
)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetArmadaDataReq, GetArmadaDataRsp
async def handle(session: Session, msg: GetArmadaDataReq) -> betterproto.Message:
return GetArmadaDataRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetArmadaStageScoreActivityReq, GetArmadaStageScoreActivityRsp
async def handle(session: Session, msg: GetArmadaStageScoreActivityReq) -> betterproto.Message:
return GetArmadaStageScoreActivityRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetAskAddFriendListReq, GetAskAddFriendListRsp
async def handle(session: Session, msg: GetAskAddFriendListReq) -> betterproto.Message:
return GetAskAddFriendListRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetAssistantFrozenListReq, GetAssistantFrozenListRsp
async def handle(session: Session, msg: GetAssistantFrozenListReq) -> betterproto.Message:
return GetAssistantFrozenListRsp(retcode=0)

View File

@@ -0,0 +1,12 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetAuthkeyReq,GetAuthkeyRsp
async def handle(session: Session, msg: GetAuthkeyReq) -> betterproto.Message:
return GetAuthkeyRsp(
retcode=0,
auth_appid=msg.auth_appid,
authkey="0",
sign_type=2,
authkey_ver=1
)

View File

@@ -0,0 +1,84 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetAvatarDataReq,
GetAvatarDataRsp,
Avatar,
AvatarSkill,
AvatarSubSkill
)
async def handle(session: Session, msg: GetAvatarDataReq) -> betterproto.Message:
rsp = GetAvatarDataRsp(retcode=0)
if len(msg.avatar_id_list) == 1 and int(msg.avatar_id_list[0]) == 0 :
rsp.is_all = True
rsp.avatar_list=[
Avatar(
avatar_id=avatar.avatar_id,
star=avatar.star,
level=avatar.level,
exp=avatar.exp,
fragment=avatar.fragment,
weapon_unique_id=avatar.weapon_id,
stigmata_unique_id_1=avatar.stigmata_ids.get(1,0),
stigmata_unique_id_2=avatar.stigmata_ids.get(2,0),
stigmata_unique_id_3=avatar.stigmata_ids.get(3,0),
skill_list=[
AvatarSkill(
skill_id=skill_id,
sub_skill_list=[
AvatarSubSkill(
sub_skill_id=sub_skill.sub_skill_id,
level=sub_skill.level
)
for sub_id, sub_skill in skill.sub_skill_lists.items()
]
)
for skill_id,skill in avatar.skill_lists.items()
],
touch_goodfeel=avatar.touch_good_feel,
today_has_add_goodfeel=avatar.today_has_add_good_feel,
dress_list=avatar.dress_lists,
dress_id=avatar.dress_id,
sub_star=avatar.sub_star
)
for id, avatar in session.player.avatars.items()
]
else:
avatar_list = []
for id in msg.avatar_id_list:
avatar = session.player.avatars.get(id)
avatar_list.append(
Avatar(
avatar_id=avatar.avatar_id,
star=avatar.star,
level=avatar.level,
exp=avatar.exp,
fragment=avatar.fragment,
weapon_unique_id=avatar.weapon_id,
stigmata_unique_id_1=avatar.stigmata_ids.get(1,0),
stigmata_unique_id_2=avatar.stigmata_ids.get(2,0),
stigmata_unique_id_3=avatar.stigmata_ids.get(3,0),
skill_list=[
AvatarSkill(
skill_id=skill_id,
sub_skill_list=[
AvatarSubSkill(
sub_skill_id=sub_skill.sub_skill_id,
level=sub_skill.level
)
for sub_id, sub_skill in skill.sub_skill_lists.items()
]
)
for skill_id,skill in avatar.skill_lists.items()
],
touch_goodfeel=avatar.touch_good_feel,
today_has_add_goodfeel=avatar.today_has_add_good_feel,
dress_list=avatar.dress_lists,
dress_id=avatar.dress_id,
sub_star=avatar.sub_star
)
)
rsp.is_all = False
rsp.avatar_list=avatar_list
return rsp

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetAvatarMissionActivityReq,GetAvatarMissionActivityRsp
async def handle(session: Session, msg: GetAvatarMissionActivityReq) -> betterproto.Message:
return GetAvatarMissionActivityRsp(retcode=0)

View File

@@ -0,0 +1,399 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetAvatarRollDataReq,
GetAvatarRollDataRsp,
AvatarRoll
)
async def handle(session: Session, msg: GetAvatarRollDataReq) -> betterproto.Message:
return GetAvatarRollDataRsp(
retcode=0,
is_all=True,
roll_list=[
AvatarRoll(
avatar_id=101,
is_unlock=True
),
AvatarRoll(
avatar_id=102,
is_unlock=True
),
AvatarRoll(
avatar_id=103,
is_unlock=True
),
AvatarRoll(
avatar_id=104,
is_unlock=True
),
AvatarRoll(
avatar_id=105,
is_unlock=True
),
AvatarRoll(
avatar_id=106,
is_unlock=True
),
AvatarRoll(
avatar_id=111,
is_unlock=True
),
AvatarRoll(
avatar_id=112,
is_unlock=True
),
AvatarRoll(
avatar_id=113,
is_unlock=True
),
AvatarRoll(
avatar_id=114,
is_unlock=True
),
AvatarRoll(
avatar_id=201,
is_unlock=True
),
AvatarRoll(
avatar_id=202,
is_unlock=True
),
AvatarRoll(
avatar_id=203,
is_unlock=True
),
AvatarRoll(
avatar_id=204,
is_unlock=True
),
AvatarRoll(
avatar_id=205,
is_unlock=True
),
AvatarRoll(
avatar_id=206,
is_unlock=True
),
AvatarRoll(
avatar_id=211,
is_unlock=True
),
AvatarRoll(
avatar_id=212,
is_unlock=True
),
AvatarRoll(
avatar_id=213,
is_unlock=True
),
AvatarRoll(
avatar_id=214,
is_unlock=True
),
AvatarRoll(
avatar_id=301,
is_unlock=True
),
AvatarRoll(
avatar_id=302,
is_unlock=True
),
AvatarRoll(
avatar_id=303,
is_unlock=True
),
AvatarRoll(
avatar_id=311,
is_unlock=True
),
AvatarRoll(
avatar_id=312,
is_unlock=True
),
AvatarRoll(
avatar_id=313,
is_unlock=True
),
AvatarRoll(
avatar_id=314,
is_unlock=True
),
AvatarRoll(
avatar_id=317,
is_unlock=True
),
AvatarRoll(
avatar_id=401,
is_unlock=True
),
AvatarRoll(
avatar_id=402,
is_unlock=True
),
AvatarRoll(
avatar_id=403,
is_unlock=True
),
AvatarRoll(
avatar_id=404,
is_unlock=True
),
AvatarRoll(
avatar_id=411,
is_unlock=True
),
AvatarRoll(
avatar_id=412,
is_unlock=True
),
AvatarRoll(
avatar_id=421,
is_unlock=True
),
AvatarRoll(
avatar_id=422,
is_unlock=True
),
AvatarRoll(
avatar_id=501,
is_unlock=True
),
AvatarRoll(
avatar_id=502,
is_unlock=True
),
AvatarRoll(
avatar_id=503,
is_unlock=True
),
AvatarRoll(
avatar_id=504,
is_unlock=True
),
AvatarRoll(
avatar_id=506,
is_unlock=True
),
AvatarRoll(
avatar_id=507,
is_unlock=True
),
AvatarRoll(
avatar_id=511,
is_unlock=True
),
AvatarRoll(
avatar_id=601,
is_unlock=True
),
AvatarRoll(
avatar_id=602,
is_unlock=True
),
AvatarRoll(
avatar_id=603,
is_unlock=True
),
AvatarRoll(
avatar_id=604,
is_unlock=True
),
AvatarRoll(
avatar_id=611,
is_unlock=True
),
AvatarRoll(
avatar_id=612,
is_unlock=True
),
AvatarRoll(
avatar_id=702,
is_unlock=True
),
AvatarRoll(
avatar_id=703,
is_unlock=True
),
AvatarRoll(
avatar_id=705,
is_unlock=True
),
AvatarRoll(
avatar_id=706,
is_unlock=True
),
AvatarRoll(
avatar_id=711,
is_unlock=True
),
AvatarRoll(
avatar_id=712,
is_unlock=True
),
AvatarRoll(
avatar_id=713,
is_unlock=True
),
AvatarRoll(
avatar_id=714,
is_unlock=True
),
AvatarRoll(
avatar_id=801,
is_unlock=True
),
AvatarRoll(
avatar_id=802,
is_unlock=True
),
AvatarRoll(
avatar_id=803,
is_unlock=True
),
AvatarRoll(
avatar_id=2201,
is_unlock=True
),
AvatarRoll(
avatar_id=2202,
is_unlock=True
),
AvatarRoll(
avatar_id=2401,
is_unlock=True
),
AvatarRoll(
avatar_id=2501,
is_unlock=True
),
AvatarRoll(
avatar_id=2601,
is_unlock=True
),
AvatarRoll(
avatar_id=2801,
is_unlock=True
),
AvatarRoll(
avatar_id=2901,
is_unlock=True
),
AvatarRoll(
avatar_id=2902,
is_unlock=True
),
AvatarRoll(
avatar_id=3101,
is_unlock=True
),
AvatarRoll(
avatar_id=3201,
is_unlock=True
),
AvatarRoll(
avatar_id=3301,
is_unlock=True
),
AvatarRoll(
avatar_id=3501,
is_unlock=True
),
AvatarRoll(
avatar_id=3601,
is_unlock=True
),
AvatarRoll(
avatar_id=3701,
is_unlock=True
),
AvatarRoll(
avatar_id=20201,
is_unlock=True
),
AvatarRoll(
avatar_id=20301,
is_unlock=True
),
AvatarRoll(
avatar_id=20401,
is_unlock=True
),
AvatarRoll(
avatar_id=70005,
progress=18
),
AvatarRoll(
avatar_id=70006,
progress=18
),
AvatarRoll(
avatar_id=70010,
progress=18
),
AvatarRoll(
avatar_id=70011,
has_take_group_list=[
111
],
progress=33
),
AvatarRoll(
avatar_id=70019,
has_take_group_list=[
191,
192
],
progress=87
),
AvatarRoll(
avatar_id=70022,
has_take_group_list=[
221,
222
],
is_unlock=True,
progress=68
),
AvatarRoll(
avatar_id=70025,
has_take_group_list=[
251,
252
],
progress=87
),
AvatarRoll(
avatar_id=70030,
has_take_group_list=[
301,
302
],
progress=87
),
AvatarRoll(
avatar_id=70032,
has_take_group_list=[
321
],
progress=33
),
AvatarRoll(
avatar_id=70038,
progress=21
),
AvatarRoll(
avatar_id=70065,
progress=33
),
AvatarRoll(
avatar_id=70080,
has_take_group_list=[
801,
802
],
is_unlock=True,
progress=63
)
]
)

View File

@@ -0,0 +1,23 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetAvatarTeamDataReq,
GetAvatarTeamDataRsp,
CustomAvatarTeam
)
async def handle(session: Session, msg: GetAvatarTeamDataReq) -> betterproto.Message:
return GetAvatarTeamDataRsp(
retcode=0,
custom_avatar_team_list=[
CustomAvatarTeam(
team_id=team.team_id,
name=team.name,
avatar_id_list=team.avatar_id_list,
elf_id_list=team.elf_id_list,
astra_mate_id=team.astral_mate_id,
is_using_astra_mate=team.is_using_astra_mate
)
for team_id,team in session.player.custom_avatar_team_list.items()
]
)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetBattlePassMissionPanelReq,GetBattlePassMissionPanelRsp
async def handle(session: Session, msg: GetBattlePassMissionPanelReq) -> betterproto.Message:
return GetBattlePassMissionPanelRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetBlackListReq, GetBlackListRsp
async def handle(session: Session, msg: GetBlackListReq) -> betterproto.Message:
return GetBlackListRsp(retcode=0)

View File

@@ -0,0 +1,22 @@
import betterproto
from game_server.net.session import Session
from game_server.utils import get_unix_in_seconds
from lib.proto import (
GetBuffEffectReq,
GetBuffEffectRsp,
BuffEffect
)
async def handle(session: Session, msg: GetBuffEffectReq) -> betterproto.Message:
return GetBuffEffectRsp(
retcode=0,
effect_list=[
BuffEffect(
effect_id=i,
end_time=int(get_unix_in_seconds()+3600*24*7)
)
for i in msg.effect_id_list
],
aura_effect_list=msg.effect_id_list[:]
)

View File

@@ -0,0 +1,304 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetBulletinActivityMissionReq,
GetBulletinActivityMissionRsp,
BulletinMissionGroup,
PanelMissionData,
PanelMissionDataPanelMissionCycleData
)
async def handle(session: Session, msg: GetBulletinActivityMissionReq) -> betterproto.Message:
return GetBulletinActivityMissionRsp(
retcode=0,
mission_group_list=[
BulletinMissionGroup(
activity_id=5931
),
BulletinMissionGroup(
activity_id=5938,
mission_list=[
PanelMissionData(
mission_id=115679,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729828800,
cycle_id=20006997,
end_time=1880308800
)
]
)
]
),
BulletinMissionGroup(
activity_id=5941,
mission_list=[
PanelMissionData(
mission_id=687511,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729828800,
cycle_id=20007074,
end_time=1880308800
)
]
)
]
),
BulletinMissionGroup(
activity_id=5943,
mission_list=[
PanelMissionData(
mission_id=687521,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729828800,
cycle_id=20007081,
end_time=1880308800
)
]
)
]
),
BulletinMissionGroup(
activity_id=5944,
mission_list=[
PanelMissionData(
mission_id=687530,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007089,
end_time=1880308800
)
]
)
]
),
BulletinMissionGroup(
activity_id=5949,
mission_list=[
PanelMissionData(
mission_id=687546,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007106,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687549,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007109,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687566,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007126,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687563,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007123,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687564,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007124,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687565,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007125,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687562,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007122,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687554,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007114,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687555,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007115,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687567,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007127,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687550,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007110,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687551,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007111,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687552,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007112,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687553,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007113,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687560,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007120,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687561,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007121,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687545,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007105,
end_time=1880308800
)
]
)
]
),
BulletinMissionGroup(
activity_id=5952
),
BulletinMissionGroup(
activity_id=5953,
mission_list=[
PanelMissionData(
mission_id=687608,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007187,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687620,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007141,
end_time=1880308800
)
]
),
PanelMissionData(
mission_id=687716,
cycle_list=[
PanelMissionDataPanelMissionCycleData(
begin_time=1729108800,
cycle_id=20007143,
end_time=1880308800
)
]
)
]
),
BulletinMissionGroup(
activity_id=5959
),
BulletinMissionGroup(
activity_id=5962
),
BulletinMissionGroup(
activity_id=5963
),
BulletinMissionGroup(
activity_id=5964
)
]
)

View File

@@ -0,0 +1,9 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetBulletinReq,GetBulletinRsp
async def handle(session: Session, msg: GetBulletinReq) -> betterproto.Message:
return GetBulletinRsp(
retcode=0,
is_all=True
)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetCardProductInfoReq,GetCardProductInfoRsp
async def handle(session: Session, msg: GetCardProductInfoReq) -> betterproto.Message:
return GetCardProductInfoRsp(retcode=0)

View File

@@ -0,0 +1,37 @@
import betterproto
from game_server.net.session import Session
from game_server.resource import ResourceManager
from game_server.resource.configdb.step_mission_compensation import StepMissionCompensationData
from lib.proto import (
GetChallengeStepCompensationInfoReq,
GetChallengeStepCompensationInfoRsp,
ChallengeStepCompensation,
StepCompensation
)
async def handle(session: Session, msg: GetChallengeStepCompensationInfoReq) -> betterproto.Message:
return GetChallengeStepCompensationInfoRsp(
retcode=0,
compensation_list=[
ChallengeStepCompensation(
compensation_id=challenge.CompensationID,
is_take_compensation=True,
new_challenge_step_compensation_list=[
StepCompensation(
step_id=id
) for id in challenge.NewChallengeStepIDList
],
old_challenge_step_compensation_list=[
StepCompensation(
step_id=id
) for id in challenge.OldChallengeStepIDList
],
mainline_step_compensation_list=[
StepCompensation(
step_id=id
) for id in challenge.MainLineStepIDList
]
)
for challenge in ResourceManager.instance().values(StepMissionCompensationData)
]
)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetChapterActivityDataReq,GetChapterActivityDataRsp
async def handle(session: Session, msg: GetChapterActivityDataReq) -> betterproto.Message:
return GetChapterActivityDataRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetChapterCompensationInfoReq,GetChapterCompensationInfoRsp
async def handle(session: Session, msg: GetChapterCompensationInfoReq) -> betterproto.Message:
return GetChapterCompensationInfoRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetChatgroupListReq, GetChatgroupListRsp
async def handle(session: Session, msg: GetChatgroupListReq) -> betterproto.Message:
return GetChatgroupListRsp(retcode=0)

View File

@@ -0,0 +1,23 @@
import betterproto
from game_server.net.session import Session
from database import mongo
from lib.proto import GetClientDataReq,GetClientDataRsp,ClientData
async def handle(session: Session, msg: GetClientDataReq) -> betterproto.Message:
data = []
client_data = list(mongo.find_documents_by_key_values("clientdata", {"ID": msg.id, "Type":msg.type}))
if client_data:
for client in client_data:
data.append(
ClientData(
id=client['ID'],
type=client['Type'],
data=client['Data'][0]
)
)
return GetClientDataRsp(
retcode=0,
type=msg.type,
id=msg.id,
client_data_list=data
)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetClientMailDataReq, GetClientMailDataRsp
async def handle(session: Session, msg: GetClientMailDataReq) -> betterproto.Message:
return GetClientMailDataRsp(retcode=0)

View File

@@ -0,0 +1,11 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetClientSettingReq,GetClientSettingRsp
async def handle(session: Session, msg: GetClientSettingReq) -> betterproto.Message:
return GetClientSettingRsp(
retcode=0,
client_setting_type=msg.client_setting_type,
is_weekly_guide_switch_on=True,
avatar_artifact_switch_list=[]
)

View File

@@ -0,0 +1,16 @@
import betterproto
from game_server.net.session import Session
from game_server.resource import ResourceManager
from game_server.resource.configdb.collection import CollectionData
from lib.proto import GetCollectionListReq, GetCollectionListRsp
async def handle(session: Session, msg: GetCollectionListReq) -> betterproto.Message:
collection = [
collection.ID
for collection in ResourceManager.instance().values(CollectionData)
]
return GetCollectionListRsp(
retcode=0,
collection_id_list=collection,
active_collection_id_list=collection
)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetConsignedOrderDataReq, GetConsignedOrderDataRsp
async def handle(session: Session, msg: GetConsignedOrderDataReq) -> betterproto.Message:
return GetConsignedOrderDataRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetCurrencyExchangeInfoReq, GetCurrencyExchangeInfoRsp
async def handle(session: Session, msg: GetCurrencyExchangeInfoReq) -> betterproto.Message:
return GetCurrencyExchangeInfoRsp(retcode=0)

View File

@@ -0,0 +1,36 @@
import betterproto
from game_server.net.session import Session
from game_server.resource import ResourceManager
from game_server.resource.configdb.custom_head_data import CustomHeadData
from lib.proto import (
GetCustomHeadDataReq,
GetCustomHeadDataRsp,
CustomHead
)
async def handle(session: Session, msg: GetCustomHeadDataReq) -> betterproto.Message:
custom_head : CustomHead = [
CustomHead(
id=custom.headID
)
for custom in ResourceManager.instance().values(CustomHeadData)
]
for i in range(161087,161091):
custom_head.append(
CustomHead(
id=i
)
)
for i in range(162199,162213):
custom_head.append(
CustomHead(
id=i
)
)
return GetCustomHeadDataRsp(
retcode=0,
custom_head_list=custom_head
)

View File

@@ -0,0 +1,441 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetDLCAvatarReq,
GetDLCAvatarRsp,
DLCAvatar,
DLCAvatarTalent
)
async def handle(session: Session, msg: GetDLCAvatarReq) -> betterproto.Message:
return GetDLCAvatarRsp(
retcode=0,
avatar_list=[
DLCAvatar(
avatar_id=1203,
equip_talent_list=[20304,20322,20327],
talent_list=[
DLCAvatarTalent(
level=3,
talent_id=20300
),
DLCAvatarTalent(
level=1,
talent_id=20301
),
DLCAvatarTalent(
level=3,
talent_id=20302
),
DLCAvatarTalent(
level=1,
talent_id=20303
),
DLCAvatarTalent(
level=1,
talent_id=20304
),
DLCAvatarTalent(
level=2,
talent_id=20305
),
DLCAvatarTalent(
level=1,
talent_id=20306
),
DLCAvatarTalent(
level=1,
talent_id=20307
),
DLCAvatarTalent(
level=3,
talent_id=20308
),
DLCAvatarTalent(
level=1,
talent_id=20309
),
DLCAvatarTalent(
level=1,
talent_id=20310
),
DLCAvatarTalent(
level=1,
talent_id=20311
),
DLCAvatarTalent(
level=1,
talent_id=20312
),
DLCAvatarTalent(
level=3,
talent_id=20313
),
DLCAvatarTalent(
level=3,
talent_id=20314
),
DLCAvatarTalent(
level=3,
talent_id=20315
),
DLCAvatarTalent(
level=2,
talent_id=20316
),
DLCAvatarTalent(
level=2,
talent_id=20317
),
DLCAvatarTalent(
level=1,
talent_id=20318
),
DLCAvatarTalent(
level=2,
talent_id=20319
),
DLCAvatarTalent(
level=1,
talent_id=20320
),
DLCAvatarTalent(
level=3,
talent_id=20321
),
DLCAvatarTalent(
level=3,
talent_id=20322
),
DLCAvatarTalent(
level=4,
talent_id=20323
),
DLCAvatarTalent(
level=2,
talent_id=20324
),
DLCAvatarTalent(
level=2,
talent_id=20325
),
DLCAvatarTalent(
level=1,
talent_id=20326
),
DLCAvatarTalent(
level=3,
talent_id=20327
),
DLCAvatarTalent(
level=3,
talent_id=20328
),
DLCAvatarTalent(
level=8,
talent_id=20329,
wait_select_affix_set_id=3
),
DLCAvatarTalent(
level=8,
talent_id=20330,
wait_select_affix_set_id=3
),
DLCAvatarTalent(
level=8,
talent_id=20331,
wait_select_affix_set_id=3
),
DLCAvatarTalent(
level=8,
talent_id=20332,
wait_select_affix_set_id=3
)
]
),
DLCAvatar(
avatar_id=1304,
equip_talent_list=[30403,30423,30430],
talent_list=[
DLCAvatarTalent(
level=1,
talent_id=30401
),
DLCAvatarTalent(
level=3,
talent_id=30402
),
DLCAvatarTalent(
level=1,
talent_id=30403
),
DLCAvatarTalent(
level=3,
talent_id=30404
),
DLCAvatarTalent(
level=1,
talent_id=30405
),
DLCAvatarTalent(
level=1,
talent_id=30406
),
DLCAvatarTalent(
level=4,
talent_id=30407
),
DLCAvatarTalent(
level=1,
talent_id=30408
),
DLCAvatarTalent(
level=3,
talent_id=30409
),
DLCAvatarTalent(
level=1,
talent_id=30410
),
DLCAvatarTalent(
level=3,
talent_id=30411
),
DLCAvatarTalent(
level=1,
talent_id=30412
),
DLCAvatarTalent(
level=1,
talent_id=30413
),
DLCAvatarTalent(
level=3,
talent_id=30414
),
DLCAvatarTalent(
level=3,
talent_id=30415
),
DLCAvatarTalent(
level=3,
talent_id=30416
),
DLCAvatarTalent(
level=1,
talent_id=30417
),
DLCAvatarTalent(
level=3,
talent_id=30418
),
DLCAvatarTalent(
level=1,
talent_id=30420
),
DLCAvatarTalent(
level=1,
talent_id=30421
),
DLCAvatarTalent(
level=3,
talent_id=30422
),
DLCAvatarTalent(
level=3,
talent_id=30423
),
DLCAvatarTalent(
level=3,
talent_id=30424
),
DLCAvatarTalent(
level=4,
talent_id=30425
),
DLCAvatarTalent(
level=1,
talent_id=30426
),
DLCAvatarTalent(
level=2,
talent_id=30427
),
DLCAvatarTalent(
level=1,
talent_id=30428
),
DLCAvatarTalent(
level=1,
talent_id=30429
),
DLCAvatarTalent(
level=3,
talent_id=30430
),
DLCAvatarTalent(
level=8,
talent_id=30431,
wait_select_affix_set_id=5
),
DLCAvatarTalent(
level=8,
talent_id=30432,
wait_select_affix_set_id=5
),
DLCAvatarTalent(
level=8,
talent_id=30433,
wait_select_affix_set_id=5
),
DLCAvatarTalent(
level=8,
talent_id=30434,
wait_select_affix_set_id=5
)
]
),
DLCAvatar(
avatar_id=1411,
equip_talent_list=[41101,41123,41124],
talent_list=[
DLCAvatarTalent(
level=1,
talent_id=41100
),
DLCAvatarTalent(
level=1,
talent_id=41101
),
DLCAvatarTalent(
level=3,
talent_id=41102
),
DLCAvatarTalent(
level=1,
talent_id=41103
),
DLCAvatarTalent(
level=3,
talent_id=41104
),
DLCAvatarTalent(
level=1,
talent_id=41105
),
DLCAvatarTalent(
level=3,
talent_id=41106
),
DLCAvatarTalent(
level=4,
talent_id=41107
),
DLCAvatarTalent(
level=3,
talent_id=41108
),
DLCAvatarTalent(
level=1,
talent_id=41109
),
DLCAvatarTalent(
level=1,
talent_id=41110
),
DLCAvatarTalent(
level=1,
talent_id=41111
),
DLCAvatarTalent(
level=1,
talent_id=41112
),
DLCAvatarTalent(
level=3,
talent_id=41113
),
DLCAvatarTalent(
level=3,
talent_id=41114
),
DLCAvatarTalent(
level=3,
talent_id=41115
),
DLCAvatarTalent(
level=1,
talent_id=41116
),
DLCAvatarTalent(
level=2,
talent_id=41117
),
DLCAvatarTalent(
level=1,
talent_id=41118
),
DLCAvatarTalent(
level=1,
talent_id=41119
),
DLCAvatarTalent(
level=2,
talent_id=41120
),
DLCAvatarTalent(
level=3,
talent_id=41122
),
DLCAvatarTalent(
level=3,
talent_id=41123
),
DLCAvatarTalent(
level=3,
talent_id=41124
),
DLCAvatarTalent(
level=1,
talent_id=41125
),
DLCAvatarTalent(
level=2,
talent_id=41126
),
DLCAvatarTalent(
level=1,
talent_id=41127
),
DLCAvatarTalent(
level=3,
talent_id=41128
),
DLCAvatarTalent(
level=2,
talent_id=41129
),
DLCAvatarTalent(
level=8,
talent_id=41130,
wait_select_affix_set_id=3
),
DLCAvatarTalent(
level=8,
talent_id=41131,
wait_select_affix_set_id=3
),
DLCAvatarTalent(
level=8,
talent_id=41132,
wait_select_affix_set_id=3
),
DLCAvatarTalent(
level=8,
talent_id=41133,
wait_select_affix_set_id=3
)
]
)
]
)

View File

@@ -0,0 +1,104 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetDLCReq,
GetDLCRsp,
DLCSupportNPC
)
async def handle(session: Session, msg: GetDLCReq) -> betterproto.Message:
return GetDLCRsp(
retcode=0,
exp=5300,
finished_dialog_id_list=[
310145,
310151,
310207,
310237,
310240,
310250,
310523,
310724,
320206,
320224,
350510,
350515,
350526,
360607,
500010006,
500010020,
500010037,
500010068,
500010069,
500010079,
500020008,
500020014,
500050003,
500060005,
500060014,
500060039,
500070016,
500070021,
500070040,
500080006,
500090006,
500090015,
500100043,
500110024,
500110039,
500110045,
500120012,
500120021,
500120036,
500130003,
500130016,
500140003,
500140017,
500140029,
500150007,
500200003,
500200036,
500200054,
500210005,
500210009,
510010006,
510010014,
510010019,
510050010,
510080005,
510080025,
510090006,
510100004,
510100022,
510110007,
510120008,
510120013
],
has_take_reward_level=30,
level=30,
name="ley",
support_npc_list=[
DLCSupportNPC(
npc_id=1,
support_level=3
),
DLCSupportNPC(
npc_id=2,
support_level=2,
support_point=75
),
DLCSupportNPC(
npc_id=3,
support_level=3
),
DLCSupportNPC(
npc_id=4,
support_level=3
),
DLCSupportNPC(
npc_id=5,
support_level=1,
support_point=2
)
]
)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetDLCTowerReq, GetDLCTowerRsp
async def handle(session: Session, msg: GetDLCTowerReq) -> betterproto.Message:
return GetDLCTowerRsp(retcode=0,schedule_id=203)

View File

@@ -0,0 +1,924 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetDormDataReq,
GetDormDataRsp,
DepotFurniture,
DormEvent,
DormHouse,
DormRoom,
Furniture
)
async def handle(session: Session, msg: GetDormDataReq) -> betterproto.Message:
return GetDormDataRsp(
retcode=0,
depot_furniture_list=[
DepotFurniture(
id=140001,
num=1
),
DepotFurniture(
id=140002,
num=1
),
DepotFurniture(
id=140003,
num=1
),
DepotFurniture(
id=140010,
num=1
),
DepotFurniture(
id=140012,
num=1
),
DepotFurniture(
id=140013,
num=1
),
DepotFurniture(
id=140015,
num=1
),
DepotFurniture(
id=140016,
num=1
),
DepotFurniture(
id=140201,
num=1
),
DepotFurniture(
id=140202,
num=1
),
DepotFurniture(
id=140213,
num=1
),
DepotFurniture(
id=140215,
num=1
),
DepotFurniture(
id=140216,
num=1
),
DepotFurniture(
id=140601,
num=1
),
DepotFurniture(
id=140603,
num=1
),
DepotFurniture(
id=140801,
num=1
),
DepotFurniture(
id=140802,
num=1
),
DepotFurniture(
id=140806,
num=1
),
DepotFurniture(
id=140810,
num=1
),
DepotFurniture(
id=140812,
num=1
),
DepotFurniture(
id=140813,
num=1
),
DepotFurniture(
id=140814,
num=1
),
DepotFurniture(
id=140815,
num=1
),
DepotFurniture(
id=140816,
num=1
),
DepotFurniture(
id=140817,
num=1
),
DepotFurniture(
id=140818,
num=1
),
DepotFurniture(
id=140819,
num=1
),
DepotFurniture(
id=140820,
num=1
),
DepotFurniture(
id=140822,
num=1
),
DepotFurniture(
id=141501,
num=1
),
DepotFurniture(
id=141601,
num=1
),
DepotFurniture(
id=141606,
num=1
),
DepotFurniture(
id=141615,
num=1
),
DepotFurniture(
id=141619,
num=1
),
DepotFurniture(
id=141620,
num=1
),
DepotFurniture(
id=141621,
num=1
),
DepotFurniture(
id=141622,
num=1
),
DepotFurniture(
id=141701,
num=1
),
DepotFurniture(
id=141702,
num=1
),
DepotFurniture(
id=141703,
num=1
),
DepotFurniture(
id=141704,
num=1
),
DepotFurniture(
id=141709,
num=1
),
DepotFurniture(
id=141713,
num=1
),
DepotFurniture(
id=141801,
num=1
),
DepotFurniture(
id=141802,
num=1
),
DepotFurniture(
id=141804,
num=1
),
DepotFurniture(
id=141805,
num=1
),
DepotFurniture(
id=141807,
num=1
),
DepotFurniture(
id=141808,
num=1
),
DepotFurniture(
id=141809,
num=1
),
DepotFurniture(
id=141810,
num=1
),
DepotFurniture(
id=141811,
num=1
),
DepotFurniture(
id=141812,
num=1
),
DepotFurniture(
id=141814,
num=1
),
DepotFurniture(
id=141815,
num=1
),
DepotFurniture(
id=146120,
num=1
),
DepotFurniture(
id=146620,
num=1
)
],
event_list=[
DormEvent(
avatar_id=101,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=102,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=103,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=104,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=105,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=106,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=111,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=112,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=113,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=114,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=201,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=202,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=203,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=204,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=205,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=206,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=211,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=212,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=213,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=214,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=301,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=302,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=303,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=311,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=312,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=313,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=314,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=317,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=401,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=402,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=403,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=404,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=411,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=412,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=421,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=422,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=501,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=502,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=503,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=504,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=506,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=507,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=511,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=601,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=602,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=603,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=604,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=611,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=612,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=702,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=703,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=705,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=706,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=711,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=712,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=713,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=714,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=801,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=802,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=803,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=2201,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=2202,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=2401,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=2501,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=2601,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=2801,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=2901,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=2902,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=3101,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=3201,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=3301,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=3501,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=3601,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=3701,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=20201,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=20301,
event_id_list=[
10007,
10011
]
),
DormEvent(
avatar_id=20401,
event_id_list=[
10007,
10011
]
)
],
house_list=[
DormHouse(
id=101,
level=39,
name="HitLey",
room_list=[
DormRoom(
avatar_list=[
412,705,
802,
2201,
2401
],
furniture_list=[
Furniture(
id=140015
),
Furniture(
id=140013
),
Furniture(
id=140016
),
],
id=1011
),
DormRoom(
avatar_list=[
105,
113,
205,
313,
612
],
furniture_list=[
Furniture(
id=140808,
pos_x=1,
pos_y=22
),
Furniture(
id=140809,
location=3,
pos_x=7,
pos_y=5
),
Furniture(
direction=3,
id=140803,
pos_x=1,
pos_y=15
),
Furniture(
direction=1,
id=140811,
pos_x=5,
pos_y=14
),
Furniture(
id=141610,
pos_x=2,
pos_y=8
),
Furniture(
id=140812,
pos_x=4,
pos_y=4
),
Furniture(
id=141806,
pos_x=9,
pos_y=7
),
Furniture(
id=141803,
pos_x=11,
pos_y=12
),
Furniture(
id=140821,
location=2,
pos_x=7,
pos_y=3
),
Furniture(
id=140002,
pos_x=26,
pos_y=2
),
Furniture(
id=140804,
pos_x=24,
pos_y=17
),
Furniture(
id=140805,
pos_x=25,
pos_y=15
),
Furniture(
id=140807,
pos_x=23,
pos_y=5
),
Furniture(
id=140825
),
Furniture(
id=140824
),
Furniture(
id=140823
)
],
id=1012
),
DormRoom(
furniture_list=[
Furniture(
id=140015
),
Furniture(
id=140013
),
Furniture(
id=140016
),
],
id=1013
)
]
)
],
is_allow_visit=True,
show_house=101,
show_room=1012,
visit_avatar=101
)

View File

@@ -0,0 +1,245 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetDropLimitActivityReq,
GetDropLimitActivityRsp,
DropLimitActivity,
DropLimitItem
)
async def handle(session: Session, msg: GetDropLimitActivityReq) -> betterproto.Message:
return GetDropLimitActivityRsp(
retcode=0,
drop_limit_activity_list=[
DropLimitActivity(
activity_id=1,
begin_time=1576029600,
drop_limit_got_num_list=[
DropLimitItem(
limit_id=101
),
DropLimitItem(
limit_id=201
),
DropLimitItem(
limit_id=301
),
DropLimitItem(
limit_id=401
)
],
end_time=1891735200
),
DropLimitActivity(
activity_id=38,
begin_time=1624500000,
drop_limit_got_num_list=[
DropLimitItem(
limit_id=3001
),
DropLimitItem(
got_num=3800,
limit_id=3002
),
DropLimitItem(
got_num=1500,
limit_id=3003
),
DropLimitItem(
got_num=1500,
limit_id=3004
),
DropLimitItem(
got_num=1500,
limit_id=3005
),
DropLimitItem(
got_num=1500,
limit_id=3006
),
DropLimitItem(
got_num=1500,
limit_id=3007
),
DropLimitItem(
got_num=1500,
limit_id=3008
),
DropLimitItem(
got_num=1500,
limit_id=3010
),
DropLimitItem(
got_num=1500,
limit_id=3013
),
DropLimitItem(
got_num=1500,
limit_id=3014
),
DropLimitItem(
got_num=1500,
limit_id=3015
),
DropLimitItem(
got_num=1500,
limit_id=3016
),
DropLimitItem(
got_num=1500,
limit_id=3017
),
DropLimitItem(
got_num=1500,
limit_id=3019
),
DropLimitItem(
got_num=1500,
limit_id=3021
),
DropLimitItem(
got_num=1500,
limit_id=3022
),
DropLimitItem(
got_num=1500,
limit_id=3026
),
DropLimitItem(
got_num=1500,
limit_id=3027
),
DropLimitItem(
got_num=1500,
limit_id=3028
),
DropLimitItem(
got_num=1500,
limit_id=3031
),
DropLimitItem(
got_num=1500,
limit_id=3032
),
DropLimitItem(
got_num=1500,
limit_id=3035
),
DropLimitItem(
got_num=1500,
limit_id=3036
),
DropLimitItem(
got_num=210,
limit_id=3040
),
DropLimitItem(
got_num=1500,
limit_id=3042
),
DropLimitItem(
got_num=1500,
limit_id=3043
),
DropLimitItem(
got_num=430,
limit_id=3045
),
DropLimitItem(
got_num=430,
limit_id=3047
),
DropLimitItem(
got_num=430,
limit_id=3048
),
DropLimitItem(
got_num=1500,
limit_id=3049
),
DropLimitItem(
got_num=430,
limit_id=3050
),
DropLimitItem(
got_num=465,
limit_id=3051
),
DropLimitItem(
got_num=465,
limit_id=3052
),
DropLimitItem(
got_num=505,
limit_id=3054
),
DropLimitItem(
got_num=505,
limit_id=3055
)
],
end_time=2068056000
),
DropLimitActivity(
activity_id=42,
begin_time=1634004000,
drop_limit_got_num_list=[
DropLimitItem(
limit_id=408
)
],
end_time=1891735200
),
DropLimitActivity(
activity_id=45,
begin_time=1644264000,
drop_limit_got_num_list=[
DropLimitItem(
limit_id=4001
)
],
end_time=1975780800
),
DropLimitActivity(
activity_id=47,
begin_time=1668045600,
drop_limit_got_num_list=[
DropLimitItem(
got_num=360,
limit_id=4003
)
],
end_time=1976558400
),
DropLimitActivity(
activity_id=48,
begin_time=1668045600,
drop_limit_got_num_list=[
DropLimitItem(
limit_id=4006
)
],
end_time=1976558400
),
DropLimitActivity(
activity_id=49,
begin_time=1668045600,
drop_limit_got_num_list=[
DropLimitItem(
got_num=1050,
limit_id=4010
),
DropLimitItem(
got_num=600,
limit_id=4012
)
],
end_time=1976558400
),
DropLimitActivity(
activity_id=50,
begin_time=1673740800,
end_time=1976558400
)
]
)

View File

@@ -0,0 +1,29 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetElfDataReq,
GetElfDataRsp,
Elf,
ElfSkill
)
async def handle(session: Session, msg: GetElfDataReq) -> betterproto.Message:
return GetElfDataRsp(
retcode=0,
elf_list=[
Elf(
elf_id=elf_id,
level=elf.level,
star=elf.star,
exp=elf.exp,
skill_list=[
ElfSkill(
skill_id=skill_id,
skill_level=skill.level
)
for skill_id,skill in elf.skill_list.items()
]
)
for elf_id,elf in session.player.elfs.items()
]
)

View File

@@ -0,0 +1,20 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetEliteChapterCompensationInfoReq,
GetEliteChapterCompensationInfoRsp,
EliteChapterCompensationInfo
)
async def handle(session: Session, msg: GetEliteChapterCompensationInfoReq) -> betterproto.Message:
return GetEliteChapterCompensationInfoRsp(
retcode=0,
chapter_list=[
EliteChapterCompensationInfo(
chapter_id=id,
has_taken_compensation=True
)
for id in range(1,35)
]
)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetEmojiDataReq, GetEmojiDataRsp
async def handle(session: Session, msg: GetEmojiDataReq) -> betterproto.Message:
return GetEmojiDataRsp(retcode=0,is_all=True)

View File

@@ -0,0 +1,29 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetEndlessStatusReq,
GetEndlessStatusRsp,
EndlessStatus,
EndlessType
)
async def handle(session: Session, msg: GetEndlessStatusReq) -> betterproto.Message:
return GetEndlessStatusRsp(
retcode=0,
cur_status=EndlessStatus(
begin_time=1730098800,
can_join_in=True,
close_time=1880308800,
end_time=1880308800,
endless_type=EndlessType.ENDLESS_TYPE_ULTRA.value,
),
next_status_list=[
EndlessStatus(
begin_time=1730444400,
close_time=1880308800,
end_time=1880308800,
endless_type=EndlessType.ENDLESS_TYPE_ULTRA.value
)
],
selected_endless_type=5
)

View File

@@ -0,0 +1,50 @@
import betterproto
from typing import List
from game_server.net.session import Session
from game_server.resource import ResourceManager
from game_server.resource.configdb.weapon_data import WeaponData
from game_server.resource.configdb.stigmata_data import StigmataData
from lib.proto import (
GetEquipmentDataReq,
GetEquipmentDataRsp,
Material,
Weapon,
Stigmata,
)
async def handle(session: Session, msg: GetEquipmentDataReq) -> betterproto.Message:
return GetEquipmentDataRsp(
retcode=0,
is_all=True,
weapon_list=[
Weapon(
unique_id=id,
id=weapon.item_id,
level=weapon.level,
exp=weapon.exp,
is_protected=weapon.is_locked,
is_extracted=weapon.is_extracted
)
for id, weapon in session.player.inventory.weapon_items.items()
],
stigmata_list=[
Stigmata(
unique_id=id,
id=stigmata.item_id,
level=stigmata.level,
exp=stigmata.exp,
slot_num=stigmata.slot_num,
refine_value=stigmata.refine_value,
promote_times=stigmata.promote_times,
is_protected=stigmata.is_locked
)
for id, stigmata in session.player.inventory.stigmata_items.items()
],
material_list=[
Material(
id=material.item_id,
num=material.num
)
for id, material in session.player.inventory.material_items.items()
]
)

View File

@@ -0,0 +1,24 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetEquipmentForgeDataReq,
GetEquipmentForgeDataRsp,
EquipmentForge
)
async def handle(session: Session, msg: GetEquipmentForgeDataReq) -> betterproto.Message:
return GetEquipmentForgeDataRsp(
retcode=0,
forge_list=[11001,11002,11003,11004,11005,11006,11007,11008,11009,11010,11011,11012,11013,11014,11015,11016,11017,11618,11619,11620,11621,11622,11623,11624,11625,11626,11627,11628,11629,11630,11631,11632,11633,12001,12002,12003,12004,12005,12006,12007,12008,12009,12010,12011,12012,12013,12014,12015,12016,12617,12618,12619,12620,12621,12622,12623,12624,12625,12626,12627,12628,12629,13001,13002,13003,13004,13005,13006,13007,13008,13009,13010,13011,13012,13013,13014,13015,13016,13617,13618,13619,13620,13621,13622,13623,13624,13625,13626,13627,13628,13629,14001,14002,14003,14004,14005,14006,14007,14008,14009,14010,14011,14012,14013,14014,14015,14016,14017,14618,14619,14620,14621,14622,14623,14624,14625,14626,14627,14628,14629,14630,12030,14031,11634,12631,13630,14632,11035,11036,11037,11038,12032,13031,14033,12033,13032,14034,11639,11640,11641,11642,11643,11644,11645,11646,11047,12034,13033,14035,11648,11649,12635,13634,14636,12036,13035,14037,12037,13036,14038,11050,12038,13037,14039,12639,13638,14640,12640,13639,14641,12041,13040,14042,12042,13041,14043,11051,11052,11053,13042,12644,13644,14645,11654,12645,13645,14646,11055,11056,11057,11059,21001,21002,21003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20013,20014,20015,20016,20017,20018,20019,20020,20021,20022,20023,20024,20025,20026,20027,20028,20029,20030,20031,20032,20033,20034,20035,20036,20037,20038,20039,20040,20041,20042,20043,20044,20045,20046,20047,20048,20049,20050,20051,20052,20053,20054,20055,20056,20057,20058,20059,20060,20061,20062,20063,20064,20065,20066,20067,70001,70002,70003,70004,70005,70006,70007,70008,70009,70010,70011,70012,70013,70014,70015,70016,70017,70018,70025,70026,70027,70028,70029,70030,70031,70032,70033,11804,11805,11806,11807,11808,11809,11810,11811,11812,11813,11814,11815,11816,11817,11818,11819,11820,11821,11822,11823,11824,11825,11826,11827,11828,11829,11830,11831,11832,11833,11834,11835,11836,31001,31002,31003,31004,31005,31006,31007,31008,31009,31010,40034,40035,70019,70020,70021,70022,70023,70024,11060,20068,20069,20070,11837,11838,11839,11840,11841,11842,11843,11844,11845,11846,11847,11848,11849,11850,20071,20072,20073,20074,20075,20076,20077,20078,20079,20080,20081,20082,20083,20084,20085,20086,20087,20088,20089,20090,20091,20092,20093,20094,20095,20096,20097,11061,11851,20098,20099,20100,11852,20101,20102,20103,11853,20104,20105,20106,11854,70034,70035,70036,20107,20108,20109,11855,11856,20110,20111,20112,11857,20113,20114,20115,11858,20116,20117,20118,11062,11063,11064,11065,20119,20120,20121,11860,11861,20122,20123,20124,11859,20125,20126,20127,20128,20129,20130,20131,20132,20133,11862,20134,20135,20136,20137,20138,20139,11863,20140,20141,20142,20143,20144,20145,11066,11864,20146,20147,20148,20149,20150,20151,11865,11866,20152,20153,20154,20155,20156,20157,20158,20159,20160],
has_forge_list=[
EquipmentForge(
forge_id=20042,
times=1
),
EquipmentForge(
forge_id=20049,
times=1
)
],
schedule_id=1
)

View File

@@ -0,0 +1,29 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetExBossInfoReq,
GetExBossInfoRsp,
ExBossInfo,
ExBossIdInfo
)
async def handle(session: Session, msg: GetExBossInfoReq) -> betterproto.Message:
return GetExBossInfoRsp(
retcode=0,
boss_info=ExBossInfo(
boss_id_list=[
ExBossIdInfo(
boss_id=48016
),
ExBossIdInfo(
boss_id=41021
),
ExBossIdInfo(
boss_id=13021
)
],
cur_max_enter_times=714,
rank_id=104,
schedule_id=10359
)
)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetExBossScheduleReq, GetExBossScheduleRsp
async def handle(session: Session, msg: GetExBossScheduleReq) -> betterproto.Message:
return GetExBossScheduleRsp(retcode=0)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetExtractReforgeActivityReq,GetExtractReforgeActivityRsp
async def handle(session: Session, msg: GetExtractReforgeActivityReq) -> betterproto.Message:
return GetExtractReforgeActivityRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetFarmActivityDataReq, GetFarmActivityDataRsp
async def handle(session: Session, msg: GetFarmActivityDataReq) -> betterproto.Message:
return GetFarmActivityDataRsp(retcode=0)

View File

@@ -0,0 +1,716 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetFinishGuideDataReq,GetFinishGuideDataRsp
async def handle(session: Session, msg: GetFinishGuideDataReq) -> betterproto.Message:
return GetFinishGuideDataRsp(
retcode=0,
guide_id_list=[
2007,
5007,
5008,
5009,
2002,
5648,
2974,
5391,
5392,
5537,
1080,
1274,
1275,
1276,
1299,
1302,
1500,
1501,
1502,
1503,
1504,
1505,
1506,
1507,
1508,
1509,
1510,
1511,
1512,
1513,
1514,
1515,
1516,
1517,
1518,
1519,
1520,
1521,
1522,
1523,
1524,
1525,
1527,
1528,
1529,
1530,
1531,
1532,
1533,
1534,
1535,
1536,
1537,
1538,
1539,
1540,
1541,
1542,
1543,
1544,
1545,
1546,
1547,
1550,
1624,
1625,
2003,
2400,
2401,
2402,
2403,
2404,
2405,
2501,
2519,
2521,
2539,
2540,
2600,
2700,
2701,
2703,
2900,
2901,
2902,
2903,
2904,
2920,
2960,
2963,
2968,
2969,
2985,
2986,
2994,
3000,
3001,
3002,
3003,
3005,
3006,
3007,
3008,
3009,
3010,
3011,
3012,
3013,
3014,
3015,
3016,
3017,
3020,
3023,
3024,
3025,
4112,
5006,
5008,
5009,
5010,
5102,
5104,
5105,
5108,
5109,
5110,
5112,
5114,
5202,
5231,
5367,
5368,
5369,
5830,
5831,
5832,
5833,
5851,
5852,
5853,
5854,
5889,
6010,
6015,
6022,
6023,
6024,
6025,
6401,
6402,
6403,
6501,
6521,
6522,
6523,
6551,
6715,
6716,
6835,
6838,
6852,
7056,
7057,
7058,
7060,
7069,
7070,
7100,
7101,
7102,
7103,
7200,
7230,
7301,
7302,
7303,
7304,
7305,
7306,
7307,
7308,
7309,
7310,
7311,
7312,
7313,
7501,
7502,
7503,
7505,
7507,
7508,
7509,
7510,
7511,
7512,
7513,
7514,
7515,
7516,
7517,
7518,
7523,
7528,
7529,
7530,
7531,
7533,
7534,
7535,
7537,
7539,
7540,
7541,
7542,
7543,
7545,
7601,
7602,
7603,
7605,
7615,
7616,
7617,
7618,
7619,
7620,
7621,
7631,
7632,
7637,
7638,
7639,
7640,
7641,
7642,
7643,
7701,
7750,
7751,
7752,
7753,
7834,
7835,
7836,
7837,
7839,
7851,
7852,
7853,
7854,
7855,
7856,
7858,
7859,
7860,
7867,
7868,
7869,
7884,
7885,
7886,
7887,
9101,
9202,
9301,
9302,
9311,
9313,
9483,
9484,
9485,
9488,
9495,
9496,
9497,
9498,
9502,
9505,
9508,
9530,
9550,
9562,
9563,
9564,
9566,
9567,
9576,
9581,
9630,
9631,
9632,
9642,
9644,
9650,
9651,
9702,
9714,
9783,
9784,
9785,
9786,
9787,
9788,
9790,
9793,
9905,
9906,
9993,
9996,
9997,
20041,
20042,
20043,
20044,
20045,
20046,
20047,
20048,
20049,
20050,
20051,
20052,
20053,
20057,
20059,
20060,
20062,
20063,
20064,
20065,
20066,
20067,
20068,
20069,
20070,
20071,
20072,
20073,
20074,
20075,
20076,
40001,
40005,
40006,
40007,
40008,
40009,
40023,
40024,
40025,
40026,
40027,
40028,
40029,
40030,
40031,
40032,
40033,
40034,
40035,
40036,
40037,
40038,
40039,
40040,
40044,
40045,
40046,
40047,
40048,
40055,
40056,
40057,
40058,
40059,
40060,
40061,
40062,
40063,
40064,
40065,
40067,
40068,
40069,
40070,
40071,
40072,
40073,
40084,
40085,
40086,
40087,
40088,
40089,
40115,
40116,
40117,
40118,
40119,
40120,
40121,
40122,
40123,
40124,
41001,
42000,
42001,
42002,
42003,
42004,
42005,
42006,
42007,
42008,
42009,
42010,
42012,
42013,
42014,
42015,
42016,
42017,
42020,
42021,
42024,
42027,
42028,
42047,
42050,
42051,
42052,
42053,
42055,
42066,
42067,
42070,
42085,
42087,
42090,
42114,
42116,
42122,
42124,
42126,
42129,
42141,
42142,
42143,
42144,
42145,
42146,
42156,
42157,
42159,
42161,
42163,
42166,
42180,
42181,
42182,
42184,
42210,
42213,
42214,
42215,
42262,
42263,
42264,
42269,
42274,
42275,
42288,
42309,
42310,
42311,
42312,
42313,
42316,
42318,
42320,
42321,
42325,
42328,
42333,
42338,
42372,
42382,
42383,
42392,
42400,
42403,
42413,
42414,
42419,
42433,
42439,
42440,
42441,
42452,
42453,
42454,
42464,
42465,
42494,
42517,
42519,
42521,
42532,
42533,
42572,
42573,
42745,
42747,
42751,
42775,
44618,
44619,
44620,
44621,
44622,
44747,
44748,
44751,
44754,
44756,
44758,
44761,
44762,
45000,
45001,
45002,
45009,
45010,
45011,
45023,
45024,
48256,
48258,
48272,
48278,
48280,
48283,
48289,
48290,
48291,
48294,
48319,
48347,
50079,
50080,
50081,
50084,
50087,
50102,
50103,
50104,
50105,
50252,
50253,
50254,
50255,
50256,
50262,
50263,
50266,
50271,
50272,
50274,
50276,
50277,
50281,
50282,
50284,
50290,
50291,
50292,
50294,
50299,
50304,
50312,
50316,
50317,
50318,
50322,
50323,
50325,
50332,
50340,
50351,
50352,
50353,
50355,
50357,
50360,
50361,
50362,
50366,
50376,
50377,
50379,
50380,
50382,
50383,
50385,
50386,
50387,
50388,
50396,
50397,
50398,
50399,
50404,
50407,
50408,
50409,
50410,
50411,
50412,
50416,
50417,
50418,
50419,
50422,
50423,
50424,
50425,
50432,
50433,
50436,
50446,
50447,
50449,
50467,
50468,
50469,
50473,
50474,
50475,
50476,
50477,
50478,
50479,
50480,
50486,
50492,
50493,
100002,
100003,
100004,
100005,
100006,
100007,
100078,
100079,
100080,
100082,
100083,
100086,
100087,
100088,
100089,
100091,
100095,
100097,
100098,
100100,
100101,
100102,
100106,
100107,
100108,
100109,
100111,
100113,
100115,
100116,
100117,
100139,
100140,
100142,
100143,
100144,
100145,
100146,
100147,
100148,
100149,
100150,
100151,
100152,
100153,
100154,
100158,
100159,
100160,
100162,
100163,
100356,
100357,
100366,
100367,
100369,
100372,
100373
]
)

View File

@@ -0,0 +1,24 @@
import betterproto
from game_server.net.session import Session
from game_server.resource import ResourceManager
from game_server.resource.configdb.frame_data import Frame_Data
from game_server.utils import get_unix_in_seconds
from lib.proto import (
GetFrameDataReq,
GetFrameDataRsp,
FrameData
)
async def handle(session: Session, msg: GetFrameDataReq) -> betterproto.Message:
return GetFrameDataRsp(
retcode=0,
is_all=True,
frame_list=[
FrameData(
id=frame.id,
expire_time=get_unix_in_seconds() + 3600 * 24 * 7
)
for frame in ResourceManager.instance().values(Frame_Data)
]
)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetFriendListReq, GetFriendListRsp
async def handle(session: Session, msg: GetFriendListReq) -> betterproto.Message:
return GetFriendListRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetFriendRemarkListReq, GetFriendRemarkListRsp
async def handle(session: Session, msg: GetFriendRemarkListReq) -> betterproto.Message:
return GetFriendRemarkListRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetGachaDisplayReq, GetGachaDisplayRsp
async def handle(session: Session, msg: GetGachaDisplayReq) -> betterproto.Message:
return GetGachaDisplayRsp(retcode=0)

View File

@@ -0,0 +1,11 @@
import betterproto
import random
from game_server.net.session import Session
from lib.proto import GetGalInteractTriggerEventReq,GetGalInteractTriggerEventRsp
async def handle(session: Session, msg: GetGalInteractTriggerEventReq) -> betterproto.Message:
return GetGalInteractTriggerEventRsp(
retcode=0,
avatar_id=msg.avatar_id,
event_id=0
)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetGardenScheduleReq, GetGardenScheduleRsp
async def handle(session: Session, msg: GetGardenScheduleReq) -> betterproto.Message:
return GetGardenScheduleRsp(retcode=0)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetGobackReq,GetGobackRsp
async def handle(session: Session, msg: GetGobackReq) -> betterproto.Message:
return GetGobackRsp(retcode=0)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,82 @@
import betterproto
from game_server.net.session import Session
from lib.proto import (
GetGrandKeyReq,
GetGrandKeyRsp,
GrandKey,
GrandKeySkill
)
async def handle(session: Session, msg: GetGrandKeyReq) -> betterproto.Message:
return GetGrandKeyRsp(
retcode=0,
is_all=True,
key_list=[
GrandKey(
activate_level=10,
breach_level=1,
end_time=1975780800,
id=203,
level=10,
skill=GrandKeySkill(
skill_id=20310
),
unlock_level=50
),
GrandKey(
id=208,
level=1,
unlock_level=65
),
GrandKey(
activate_level=10,
breach_level=1,
end_time=1975780800,
id=205,
level=10,
skill=GrandKeySkill(
skill_id=20509
),
unlock_level=65
),
GrandKey(
activate_level=10,
breach_level=2,
end_time=1975780800,
id=202,
level=10,
skill=GrandKeySkill(
skill_id=20209
),
unlock_level=50
),
GrandKey(
breach_level=1,
id=207,
level=1,
unlock_level=65
),
GrandKey(
breach_level=1,
id=204,
level=1,
unlock_level=65
),
GrandKey(
activate_level=10,
end_time=1975780800,
id=201,
level=10,
skill=GrandKeySkill(
skill_id=20109
),
unlock_level=50
),
GrandKey(
breach_level=1,
id=206,
level=1,
unlock_level=35
)
]
)

View File

@@ -0,0 +1,6 @@
import betterproto
from game_server.net.session import Session
from lib.proto import GetGratuityActivityReq,GetGratuityActivityRsp
async def handle(session: Session, msg: GetGratuityActivityReq) -> betterproto.Message:
return GetGratuityActivityRsp(retcode=0)

Some files were not shown because too many files have changed in this diff Show More