public override void DoWrite(ByteWriter BW) { BW.AppendInt32(ActivePlayerIndex); BW.AppendInt32(ActiveSquadIndex); BW.AppendByte((byte)ActiveSquad.CurrentLeader.BattleDefenseChoice); BW.AppendInt32(ActiveSquad.CurrentLeader.AttackIndex); BW.AppendInt32(TargetPlayerIndex); BW.AppendInt32(TargetSquadIndex); BW.AppendByte((byte)TargetSquad.CurrentLeader.BattleDefenseChoice); BW.AppendInt32(TargetSquad.CurrentLeader.AttackIndex); BW.AppendBoolean(IsDefending); BW.AppendByte((byte)Map.BattleMenuStage); if (Map.IsServer) { BW.AppendInt32(AttackingResult.ArrayResult.Length); for (int R = 0; R < AttackingResult.ArrayResult.Length; ++R) { BW.AppendInt32(AttackingResult.ArrayResult[R].Accuracy); BW.AppendInt32(AttackingResult.ArrayResult[R].AttackAttackerFinalEN); BW.AppendInt32(AttackingResult.ArrayResult[R].AttackDamage); BW.AppendBoolean(AttackingResult.ArrayResult[R].AttackMissed); BW.AppendBoolean(AttackingResult.ArrayResult[R].AttackShootDown); BW.AppendBoolean(AttackingResult.ArrayResult[R].AttackSwordCut); BW.AppendBoolean(AttackingResult.ArrayResult[R].AttackWasCritical); BW.AppendString(AttackingResult.ArrayResult[R].Barrier); BW.AppendBoolean(AttackingResult.ArrayResult[R].Shield); BW.AppendInt32(AttackingResult.ArrayResult[R].TargetPlayerIndex); BW.AppendInt32(AttackingResult.ArrayResult[R].TargetSquadIndex); BW.AppendInt32(AttackingResult.ArrayResult[R].TargetUnitIndex); } BW.AppendInt32(DefendingResult.ArrayResult.Length); for (int R = 0; R < DefendingResult.ArrayResult.Length; ++R) { BW.AppendInt32(DefendingResult.ArrayResult[R].Accuracy); BW.AppendInt32(DefendingResult.ArrayResult[R].AttackAttackerFinalEN); BW.AppendInt32(DefendingResult.ArrayResult[R].AttackDamage); BW.AppendBoolean(DefendingResult.ArrayResult[R].AttackMissed); BW.AppendBoolean(DefendingResult.ArrayResult[R].AttackShootDown); BW.AppendBoolean(DefendingResult.ArrayResult[R].AttackSwordCut); BW.AppendBoolean(DefendingResult.ArrayResult[R].AttackWasCritical); BW.AppendString(DefendingResult.ArrayResult[R].Barrier); BW.AppendBoolean(DefendingResult.ArrayResult[R].Shield); BW.AppendInt32(DefendingResult.ArrayResult[R].TargetPlayerIndex); BW.AppendInt32(DefendingResult.ArrayResult[R].TargetSquadIndex); BW.AppendInt32(DefendingResult.ArrayResult[R].TargetUnitIndex); } } else { } }
public override void DoWrite(ByteWriter BW) { BW.AppendInt32(ActivePlayerIndex); BW.AppendInt32(ActiveSquadIndex); BW.AppendByte((byte)ActiveSquad.CurrentLeader.BattleDefenseChoice); BW.AppendInt32(ActiveSquad.CurrentLeader.AttackIndex); BW.AppendInt32(TargetPlayerIndex); BW.AppendInt32(TargetSquadIndex); BW.AppendByte((byte)TargetSquad.CurrentLeader.BattleDefenseChoice); BW.AppendInt32(TargetSquad.CurrentLeader.AttackIndex); BW.AppendByte((byte)Map.BattleMenuStage); }
public override byte[] GetSnapshotData() { ByteWriter BW = new ByteWriter(); BW.AppendInt32(ListAllPlayer.Count); foreach (Player ActivePlayer in ListAllPlayer) { BW.AppendString(ActivePlayer.ConnectionID); BW.AppendString(ActivePlayer.Name); BW.AppendInt32(ActivePlayer.Team); BW.AppendBoolean(ActivePlayer.IsPlayerControlled); BW.AppendByte(ActivePlayer.Color.R); BW.AppendByte(ActivePlayer.Color.G); BW.AppendByte(ActivePlayer.Color.B); BW.AppendByte(ActivePlayer.LocalPlayerIndex); BW.AppendInt32(ActivePlayer.ListSquad.Count); foreach (Squad ActiveSquad in ActivePlayer.ListSquad) { BW.AppendFloat(ActiveSquad.X); BW.AppendFloat(ActiveSquad.Y); BW.AppendFloat(ActiveSquad.Z); BW.AppendBoolean(ActiveSquad.IsPlayerControlled); BW.AppendInt32(ActiveSquad.UnitsInSquad); for (int U = 0; U < ActiveSquad.UnitsInSquad; ++U) { Unit ActiveUnit = ActiveSquad.At(U); BW.AppendString(ActiveUnit.UnitTypeName); BW.AppendString(ActiveUnit.RelativePath); BW.AppendInt32(ActiveUnit.ArrayCharacterActive.Length); for (int C = 0; C < ActiveUnit.ArrayCharacterActive.Length; ++C) { BW.AppendString(ActiveUnit.ArrayCharacterActive[C].FullName); } } } } BW.AppendString(BattleMapPath); byte[] Data = BW.GetBytes(); BW.ClearWriteBuffer(); return(Data); }
public byte[] GetClientInfo(string ClientID) { FilterDefinition <BsonDocument> LastTimeCheckedFilter = Builders <BsonDocument> .Filter.Eq("_id", new ObjectId(ClientID)); BsonDocument FoundPlayerDocument = PlayersCollection.Find(LastTimeCheckedFilter).FirstOrDefault(); ByteWriter BW = new ByteWriter(); BW.AppendByte((byte)FoundPlayerDocument.GetValue("Ranking").AsInt32); BW.AppendByte((byte)FoundPlayerDocument.GetValue("License").AsInt32); BW.AppendString(FoundPlayerDocument.GetValue("Guild").AsString); byte[] ClientInfo = BW.GetBytes(); BW.ClearWriteBuffer(); return(ClientInfo); }