Supercell.GUT/Supercell.GUT.Logic/Player/LogicPlayerAttributes.cs
BreadDEV 8c6a533918 [v0.0.2] you can enter menu now. but still early state
todo: improve code and finish base structures
2024-03-05 17:37:18 +07:00

94 lines
2.8 KiB
C#

using Supercell.GUT.Logic.Base;
using Supercell.GUT.Logic.Team;
using Supercell.GUT.Titan.Logic.DataStream;
using Supercell.GUT.Titan.Logic.Util;
namespace Supercell.GUT.Logic.Player;
public class LogicPlayerAttributes : LogicBase
{
public int ExpLevel { get; set; }
public int ExpPoints { get; set; }
public int Money { get; set; }
public int Diamonds { get; set; }
public int LeagueMmr { get; set; }
public int LeagueMmrKFactor { get; set; }
public string TeamName { get; set; }
public LogicArrayList<LogicTeamUnit> TeamUnits { get; set; }
public LogicArrayList<string> ReadHandbooks { get; set; }
public LogicPlayerAttributes(int logicDataVersion) : base(logicDataVersion)
{
this.TeamName = string.Empty;
this.TeamUnits = new LogicArrayList<LogicTeamUnit>();
for (int i = 0; i <= 4; i++)
{
LogicTeamUnit logicTeamUnit = LogicTeamUnit.CreateDefaultUnit(i);
switch (i)
{
case 0:
logicTeamUnit.SetSkill("sk_magnum0");
break;
case 1:
logicTeamUnit.SetSkill("sk_grenade0");
break;
case 2:
logicTeamUnit.SetSkill("sk_magnum0");
break;
case 3:
logicTeamUnit.SetSkill("sk_magnum0");
break;
case 4:
logicTeamUnit.SetSkill("sk_grenade0");
break;
default:
break;
}
this.TeamUnits.Add(logicTeamUnit);
}
this.ReadHandbooks = new LogicArrayList<string>();
}
public override void Destruct()
{
base.Destruct();
}
public override void Encode(ChecksumEncoder checksumEncoder)
{
base.Encode(checksumEncoder);
checksumEncoder.WriteInt(this.ExpLevel);
checksumEncoder.WriteInt(this.ExpPoints);
checksumEncoder.WriteInt(this.Money);
checksumEncoder.WriteInt(this.Diamonds);
checksumEncoder.WriteInt(this.LeagueMmr);
checksumEncoder.WriteInt(this.LeagueMmrKFactor);
checksumEncoder.WriteString(this.TeamName);
checksumEncoder.WriteInt(this.TeamUnits.Size());
for (int i = 0; i < this.TeamUnits.Size(); i++)
{
this.TeamUnits[i].Encode(checksumEncoder);
}
checksumEncoder.WriteInt(this.ReadHandbooks.Size());
for (int i = 0; i < this.ReadHandbooks.Size(); i++)
{
checksumEncoder.WriteString(this.ReadHandbooks[i]);
}
checksumEncoder.WriteInt(-1);
checksumEncoder.WriteInt(0);
}
public override void Decode(ByteStream byteStream)
{
base.Decode(byteStream);
}
}