WutheringWaves/GameServer/Controllers/WorldController.cs

215 lines
10 KiB
C#
Raw Normal View History

2024-02-09 22:15:05 +00:00
using GameServer.Controllers.Attributes;
using GameServer.Controllers.Event;
2024-02-09 09:20:14 +00:00
using GameServer.Models;
2024-02-07 21:41:39 +00:00
using GameServer.Network;
2024-02-09 22:15:05 +00:00
using GameServer.Network.Messages;
2024-02-07 21:41:39 +00:00
using Protocol;
2024-02-09 22:15:05 +00:00
namespace GameServer.Controllers;
internal class WorldController : Controller
2024-02-07 21:41:39 +00:00
{
2024-02-09 22:15:05 +00:00
public WorldController(PlayerSession session) : base(session)
2024-02-07 21:41:39 +00:00
{
2024-02-09 22:15:05 +00:00
// WorldMessageHandler.
2024-02-07 21:41:39 +00:00
}
2024-02-09 22:15:05 +00:00
[GameEvent(GameEventType.EnterGame)]
public async Task OnEnterGame(ModelManager modelManager)
2024-02-07 21:41:39 +00:00
{
2024-02-09 22:15:05 +00:00
PlayerModel player = modelManager.Player;
2024-02-07 21:41:39 +00:00
2024-02-09 22:15:05 +00:00
await Session.Push(MessageId.JoinSceneNotify, new JoinSceneNotify
2024-02-07 21:41:39 +00:00
{
MaxEntityId = 2,
TransitionOption = new TransitionOptionPb
{
TransitionType = (int)TransitionType.Empty
},
SceneInfo = new SceneInformation
{
2024-02-09 22:15:05 +00:00
OwnerId = player.Id,
2024-02-07 21:41:39 +00:00
Mode = (int)SceneMode.Single,
InstanceId = 8,
AoiData = new PlayerSceneAoiData
{
2024-02-09 22:15:05 +00:00
GenIds = { 1 },
2024-02-07 21:41:39 +00:00
Entities =
{
new EntityPb
{
EntityState = (int)EntityState.Born,
EntityType = (int)EEntityType.Player,
2024-02-09 22:15:05 +00:00
PlayerId = player.Id,
2024-02-07 21:41:39 +00:00
LivingStatus = (int)LivingStatus.Alive,
2024-02-09 22:15:05 +00:00
ConfigId = player.CharacterId,
2024-02-07 21:41:39 +00:00
ConfigType = (int)EntityConfigType.Character,
Id = 1,
IsVisible = true,
Pos = new Vector
{
X = 4000,
Y = -2000,
Z = 260
},
Rot = new(),
InitLinearVelocity = new(),
PrefabIncId = 0,
InitPos = new Vector
{
X = 4000,
Y = -2000,
Z = 260
},
ComponentPbs =
{
new EntityComponentPb
{
VisionSkillComponent = new VisionSkillComponentPb
{
VisionSkillInfos =
{
new VisionSkillInformation
{
SkillId = 1302001,
Level = 1,
Quality = 1,
}
}
},
},
new EntityComponentPb
{
AttributeComponent = new AttributeComponentPb
{
GameAttributes =
{
new GameplayAttributeData
{
AttributeType = (int)EAttributeType.Life,
BaseValue = 1000,
CurrentValue = 1000
},
new GameplayAttributeData
{
AttributeType = (int)EAttributeType.LifeMax,
BaseValue = 1000,
CurrentValue = 1000
},
new GameplayAttributeData
{
AttributeType = (int)EAttributeType.EnergyMax,
BaseValue = 10,
CurrentValue = 10
},
new GameplayAttributeData
{
AttributeType = (int)EAttributeType.Energy,
BaseValue = 10,
CurrentValue = 10
},
new GameplayAttributeData
{
AttributeType = (int)EAttributeType.SpecialEnergy3,
BaseValue = 10,
CurrentValue = 10
},
new GameplayAttributeData
{
AttributeType = (int)EAttributeType.SpecialEnergy3Max,
BaseValue = 10,
CurrentValue = 10
},
new GameplayAttributeData
{
AttributeType = (int)EAttributeType.AutoAttackSpeed,
BaseValue = 10000,
CurrentValue = 10000
},
new GameplayAttributeData
{
AttributeType = (int)EAttributeType.CastAttackSpeed,
BaseValue = 10000,
CurrentValue = 10000
},
new GameplayAttributeData
{
AttributeType = (int)EAttributeType.Atk,
BaseValue = 1,
CurrentValue = 1
},
new GameplayAttributeData
{
AttributeType = (int)EAttributeType.Lv,
BaseValue = 1,
CurrentValue = 1
},
},
}
},
new EntityComponentPb
{
ConcomitantsComponentPb = new ConcomitantsComponentPb
{
CustomEntityIds = {1},
},
}
},
}
}
},
TimeInfo = new SceneTimeInfo
{
Hour = 23
},
2024-02-09 22:15:05 +00:00
PlayerInfos =
2024-02-07 21:41:39 +00:00
{
new ScenePlayerInformation
{
2024-02-09 22:15:05 +00:00
PlayerId = player.Id,
2024-02-07 21:41:39 +00:00
Level = 1,
IsOffline = false,
Location = new()
{
X = 4000,
Y = -2000,
Z = 260
},
FightRoleInfos =
{
new FightRoleInformation
{
EntityId = 1,
CurHp = 1000,
MaxHp = 1000,
IsControl = true,
2024-02-09 22:15:05 +00:00
RoleId = player.CharacterId,
2024-02-07 21:41:39 +00:00
RoleLevel = 1,
}
},
2024-02-09 22:15:05 +00:00
PlayerName = player.Name
2024-02-07 21:41:39 +00:00
}
},
2024-02-09 22:15:05 +00:00
CurContextId = player.Id
2024-02-07 21:41:39 +00:00
}
});
2024-02-09 22:15:05 +00:00
}
2024-02-07 21:41:39 +00:00
2024-02-09 22:15:05 +00:00
[NetEvent(MessageId.EntityActiveRequest)]
public ResponseMessage OnEntityActiveRequest() => Response(MessageId.EntityActiveResponse, new EntityActiveResponse());
2024-02-08 08:05:31 +00:00
2024-02-09 22:15:05 +00:00
[NetEvent(MessageId.EntityOnLandedRequest)]
public ResponseMessage OnEntityOnLandedRequest() => Response(MessageId.EntityOnLandedResponse, new EntityOnLandedResponse());
2024-02-07 21:41:39 +00:00
2024-02-09 22:15:05 +00:00
[NetEvent(MessageId.PlayerMotionRequest)]
public ResponseMessage OnPlayerMotionRequest() => Response(MessageId.PlayerMotionResponse, new PlayerMotionResponse());
[NetEvent(MessageId.EntityLoadCompleteRequest)]
public ResponseMessage OnEntityLoadCompleteRequest() => Response(MessageId.EntityLoadCompleteResponse, new EntityLoadCompleteResponse());
[NetEvent(MessageId.SceneLoadingFinishRequest)]
public ResponseMessage OnSceneLoadingFinishRequest() => Response(MessageId.SceneLoadingFinishResponse, new SceneLoadingFinishResponse());
[NetEvent(MessageId.UpdateSceneDateRequest)]
public ResponseMessage OnUpdateSceneDateRequest() => Response(MessageId.UpdateSceneDateResponse, new UpdateSceneDateResponse());
2024-02-07 21:41:39 +00:00
}