add more lineup & add SwitchLineup
This commit is contained in:
@@ -56,13 +56,14 @@ class PlayerManager(BaseModel):
|
|||||||
def add_all_lineups(self):
|
def add_all_lineups(self):
|
||||||
lineups = get_all_lineup_by_uid(uid=self.data.uid)
|
lineups = get_all_lineup_by_uid(uid=self.data.uid)
|
||||||
if not lineups:
|
if not lineups:
|
||||||
lineup = LineupData(
|
for i in range(0, 10):
|
||||||
uid=self.data.uid,
|
lineup = LineupData(
|
||||||
index=0,
|
uid=self.data.uid,
|
||||||
name="",
|
index=i,
|
||||||
avatar_list=[self.data.cur_basic_type]
|
name="",
|
||||||
).add_lineup()
|
avatar_list=[self.data.cur_basic_type] if i == 0 else []
|
||||||
self.lineup_manager[lineup.index] = lineup
|
).add_lineup()
|
||||||
|
self.lineup_manager[lineup.index] = lineup
|
||||||
for lineup in lineups:
|
for lineup in lineups:
|
||||||
self.lineup_manager[lineup.index] = lineup
|
self.lineup_manager[lineup.index] = lineup
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ async def handle(session: PlayerSession, msg: GetSceneMapInfoCsReq) -> betterpro
|
|||||||
for prop in group.PropList:
|
for prop in group.PropList:
|
||||||
maze_prop = MazePropState(
|
maze_prop = MazePropState(
|
||||||
group_id=group_id,
|
group_id=group_id,
|
||||||
state=8 if prop.MappingInfoID > 0 else (1 if prop.State == 0 else prop.State),
|
state=prop.State if prop.State else 0,
|
||||||
config_id=prop.ID
|
config_id=prop.ID
|
||||||
)
|
)
|
||||||
if prop.MappingInfoID > 0:
|
if prop.MappingInfoID > 0:
|
||||||
|
|||||||
48
game_server/handlers/SwitchLineupIndexCsReq.py
Normal file
48
game_server/handlers/SwitchLineupIndexCsReq.py
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import betterproto
|
||||||
|
from game_server.net.session import PlayerSession
|
||||||
|
from game_server.game.motion.motion_info import Motion
|
||||||
|
from rail_proto.lib import (
|
||||||
|
SwitchLineupIndexCsReq,
|
||||||
|
SwitchLineupIndexScRsp,
|
||||||
|
SyncLineupNotify,
|
||||||
|
SceneGroupRefreshScNotify,
|
||||||
|
GroupRefreshInfo,
|
||||||
|
SceneGroupRefreshType,
|
||||||
|
SceneEntityRefreshInfo
|
||||||
|
)
|
||||||
|
|
||||||
|
async def handle(session: PlayerSession, msg: SwitchLineupIndexCsReq) -> betterproto.Message | None:
|
||||||
|
lineup_data = session.player.lineup_manager.get(msg.index)
|
||||||
|
if not lineup_data: return None
|
||||||
|
await session.notify(
|
||||||
|
SyncLineupNotify(
|
||||||
|
lineup=lineup_data.ToProto()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
player_pos = Motion(
|
||||||
|
x=session.player.data.pos.x,
|
||||||
|
y=session.player.data.pos.y,
|
||||||
|
z=session.player.data.pos.z,
|
||||||
|
rotY=session.player.data.rot.y
|
||||||
|
).ToProto()
|
||||||
|
for avatar_id in lineup_data.avatar_list:
|
||||||
|
session.pending_notify(
|
||||||
|
SceneGroupRefreshScNotify(
|
||||||
|
floor_id=session.player.data.floor_id,
|
||||||
|
group_refresh_list=[
|
||||||
|
GroupRefreshInfo(
|
||||||
|
refresh_type=SceneGroupRefreshType.SCENE_GROUP_REFRESH_TYPE_LOADED.value,
|
||||||
|
refresh_entity=[
|
||||||
|
SceneEntityRefreshInfo(
|
||||||
|
add_entity=session.player.scene_manager.Actor(avatar_id, player_pos)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
session.player.data.cur_lineup = msg.index
|
||||||
|
return SwitchLineupIndexScRsp(
|
||||||
|
retcode=0,
|
||||||
|
index=msg.index
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user