Skip to content

Commit

Permalink
charselectinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
shnok committed Oct 27, 2024
1 parent 20544e9 commit 65486ab
Show file tree
Hide file tree
Showing 28 changed files with 531 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public struct CharSelectionInfoPackage
[SerializeField] private PlayerStats _playerStats;
[SerializeField] private bool _isMage;
[SerializeField] private byte _classId;
[SerializeField] private byte _baseClassId;
[SerializeField] private int _exp;
[SerializeField] private int _sp;
[SerializeField] private float _expPercent;
Expand Down Expand Up @@ -44,5 +45,6 @@ public struct CharSelectionInfoPackage
public int DeleteTimer { get => _deleteTimer; set => _deleteTimer = value; }
public int ClanId { get => _clanId; set => _clanId = value; }
public bool Selected { get => _selected; set => _selected = value; }
public byte BaseClassId { get => _baseClassId; set => _baseClassId = value; }

}
40 changes: 39 additions & 1 deletion l2-unity/Assets/Scripts/Game/Entity/Enum/CharacterClass.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
public enum CharacterClass : byte {
public enum CharacterClass : byte
{
Fighter = 0x00,
Warrior = 0x01,
Gladiator = 0x02,
Expand Down Expand Up @@ -66,3 +67,40 @@ public enum CharacterClass : byte {
Artisan = 0x38,
Warsmith = 0x39
}

public class CharacterClassParser
{
public static bool IsMage(CharacterClass characterClass)
{
switch (characterClass)
{
case CharacterClass.Mage:
case CharacterClass.Wizard:
case CharacterClass.Sorceror:
case CharacterClass.Necromancer:
case CharacterClass.Warlock:
case CharacterClass.Cleric:
case CharacterClass.Bishop:
case CharacterClass.Prophet:
case CharacterClass.ElvenMage:
case CharacterClass.ElvenWizard:
case CharacterClass.Spellsinger:
case CharacterClass.ElementalSummoner:
case CharacterClass.Oracle:
case CharacterClass.Elder:
case CharacterClass.DarkMage:
case CharacterClass.DarkWizard:
case CharacterClass.Spellhowler:
case CharacterClass.PhantomSummoner:
case CharacterClass.ShillienOracle:
case CharacterClass.ShillenElder:
case CharacterClass.OrcMage:
case CharacterClass.OrcShaman:
case CharacterClass.Overlord:
case CharacterClass.Warcryer:
return true;
default:
return false;
}
}
}
5 changes: 5 additions & 0 deletions l2-unity/Assets/Scripts/Game/Entity/Enum/CharacterSex.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public enum CharacterSex
{
Male = 0,
Female = 1
}
2 changes: 2 additions & 0 deletions l2-unity/Assets/Scripts/Game/Entity/Enum/CharacterSex.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions l2-unity/Assets/Scripts/Game/Manager/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ public void SwitchToCharSelect()
LoginCameraManager.Instance.SwitchCamera("CharSelect");
}

public void OnCharCreateOk()
{
SwitchToCharSelect();
}

public void OnLoginUILoaded()
{
if (GameState == GameState.RESTARTING)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
public class RequestCharCreatePacket : ClientPacket
{
public RequestCharCreatePacket(string name, CharacterRace race, CharacterSex sex, CharacterClass characterClass, int hairstyle, int haircolor, int face) : base((byte)GameClientPacketType.RequestCharCreate)
{
WriteS(name);
WriteI((int)race);
WriteI((int)sex);
WriteI((int)characterClass);
WriteI(0);
WriteI(0);
WriteI(0);
WriteI(0);
WriteI(0);
WriteI(0);
WriteI(hairstyle);
WriteI(haircolor);
WriteI(face);
BuildPacket();
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public enum GameClientPacketType : byte
AuthRequest = 0x08,
Disconnect = 0x09,
RequestAttack = 0x0a,
RequestCharCreate = 0x0b,
RequestCharSelect = 0x0d,
RequestInventoryOpen = 0x0f,
RequestUnEquip = 0x11,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,58 @@
public enum GameServerPacketType : byte
{
VersionCheck = 0x00,
LoginFail = 0x01,
CharSelectionInfo = 0x02,
MessagePacket = 0x04,
SystemMessage = 0x05,
PlayerInfo = 0x06,
ObjectPosition = 0x07,
RemoveObject = 0x08,
ObjectRotation = 0x09,
ObjectAnimation = 0x0A,
ApplyDamage = 0x0B,
NpcInfo = 0x0C,
ObjectMoveTo = 0x0D,
UserInfo = 0x0E,
ObjectMoveDirection = 0x0F,
GameTime = 0x10,
EntitySetTarget = 0x11,
AutoAttackStart = 0x12,
AutoAttackStop = 0x13,
ActionFailed = 0x14,
ServerClose = 0x15,
StatusUpdate = 0x16,
ActionAllowed = 0x17,
InventoryItemList = 0x18,
InventoryUpdate = 0x19,
LeaveWorld = 0x1A,
RestartReponse = 0x1B,
ShortcutInit = 0x1C,
ShortcutRegister = 0x1D,
SocialAction = 0x1E,
ChangeWaitType = 0x1F,
ChangeMoveType = 0x20,

Ping = 0xF0,
CharSelectionInfo = 0x13,
LoginFail = 0x14,
CharCreateOk = 0x19,
CharCreateFail = 0x1a,


















MessagePacket = 0xF4,
SystemMessage = 0xF5,
PlayerInfo = 0xF6,
ObjectPosition = 0xF7,
RemoveObject = 0xF8,
ObjectRotation = 0xF9,
ObjectAnimation = 0xFA,
ApplyDamage = 0xFB,
NpcInfo = 0xFC,
ObjectMoveTo = 0xFD,
UserInfo = 0xFE,
ObjectMoveDirection = 0xFF,
GameTime = 0xD0,
EntitySetTarget = 0xD1,
AutoAttackStart = 0xD2,
AutoAttackStop = 0xD3,
ActionFailed = 0xD4,
ServerClose = 0xD5,
StatusUpdate = 0xD6,
ActionAllowed = 0xD7,
InventoryItemList = 0xD8,
InventoryUpdate = 0xD9,
LeaveWorld = 0xDA,
RestartReponse = 0xDB,
ShortcutInit = 0xDC,
ShortcutRegister = 0xDD,
SocialAction = 0xDE,
ChangeWaitType = 0xDF,
ChangeMoveType = 0xE0,

Ping = 0xE1,

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
public class CharCreateFailPacket : ServerPacket
{
public enum CreateFailReason
{
REASON_CREATION_FAILED = 0x00,
REASON_TOO_MANY_CHARACTERS = 0x01,
REASON_NAME_ALREADY_EXISTS = 0x02,
REASON_INCORRECT_NAME = 0x04
}

public int Reason { get; private set; }
public CharCreateFailPacket(byte[] d) : base(d)
{
Parse();
}

public override void Parse()
{
Reason = ReadI();
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
public class CharCreateOkPacket : ServerPacket
{
public CharCreateOkPacket(byte[] d) : base(d)
{
Parse();
}

public override void Parse()
{
ReadI();
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 65486ab

Please sign in to comment.