public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(ActivePlayerIndex);
     BW.AppendInt32(TransformingUnitIndex);
     BW.AppendInt32(Map.ListPlayer[ActivePlayerIndex].ListSquad.IndexOf(ActiveSquad));
     BW.AppendBoolean(ShowSquadMembers);
 }
示例#2
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(ActivePlayerIndex);
     BW.AppendInt32(ActiveSquadIndex);
     BW.AppendFloat(CursorPosition.X);
     BW.AppendFloat(CursorPosition.Y);
     BW.AppendFloat(CursorPosition.Z);
 }
示例#3
0
        public override void DoWrite(ByteWriter BW)
        {
            BW.AppendInt32(ActivePlayerIndex);
            BW.AppendInt32(ActiveSquadIndex);

            BW.AppendInt32(Target.Item1);
            BW.AppendInt32(Target.Item2);
        }
示例#4
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendBoolean(BattlePreview != null);
     if (BattlePreview != null)
     {
         BW.AppendInt32(BattlePreview.PlayerIndex);
         BW.AppendInt32(BattlePreview.SquadIndex);
     }
 }
示例#5
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(ActionMenuCursor);
     BW.AppendInt32(ListMapChangeChoice.Count);
     for (int C = 0; C < ListMapChangeChoice.Count; ++C)
     {
         BW.AppendString(ListMapChangeChoice[C].MapName);
     }
 }
示例#6
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(ActivePlayerIndex);
     BW.AppendInt32(ActivePlayer.ListCardInHand.Count);
     for (int C = 0; C < ActivePlayer.ListCardInHand.Count; ++C)
     {
         BW.AppendString(ActivePlayer.ListCardInHand[C].Path);
     }
 }
示例#7
0
        public override void DoWrite(ByteWriter BW)
        {
            BW.AppendInt32(ListMVChoice.Count);

            for (int M = 0; M < ListMVChoice.Count; ++M)
            {
                BW.AppendFloat(ListMVChoice[M].Position.X);
                BW.AppendFloat(ListMVChoice[M].Position.Y);
                BW.AppendInt32((int)ListMVChoice[M].Position.Z);
            }
        }
示例#8
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(ActivePlayerIndex);
     BW.AppendInt32(ActiveSquadIndex);
     BW.AppendFloat(LastPosition.X);
     BW.AppendFloat(LastPosition.Y);
     BW.AppendInt32((int)LastPosition.Z);
     BW.AppendFloat(LastCameraPosition.X);
     BW.AppendFloat(LastCameraPosition.Y);
     BW.AppendFloat(LastCameraPosition.Z);
 }
示例#9
0
        public override void DoWrite(ByteWriter BW)
        {
            BW.AppendInt32(ActivePlayerIndex);
            BW.AppendInt32(ActiveSquadIndex);
            BW.AppendInt32(ActiveSquad.CurrentLeader.AttackIndex);
            BW.AppendInt32(ListAttackChoice.Count);

            for (int A = 0; A < ListAttackChoice.Count; ++A)
            {
                BW.AppendFloat(ListAttackChoice[A].X);
                BW.AppendFloat(ListAttackChoice[A].Y);
                BW.AppendInt32((int)ListAttackChoice[A].Z);
            }
        }
        public List <PlayerPOCO> GetFriendList(string ClientID)
        {
            List <PlayerPOCO> ListFriend = new List <PlayerPOCO>();

            FilterDefinition <BsonDocument> IDFilter = Builders <BsonDocument> .Filter.Eq("_id", new ObjectId(ClientID));

            BsonDocument result = PlayersCollection.Aggregate().Match(IDFilter).Lookup("TripleThunder", "Friends", "_id", "FriendsInfo").FirstOrDefault();

            BsonArray Friends = result.GetValue("FriendsInfo").AsBsonArray;

            foreach (BsonDocument ActiveFriend in Friends)
            {
                PlayerPOCO FoundPlayer = new PlayerPOCO();
                FoundPlayer.ID = ActiveFriend.GetValue("_id").AsObjectId.ToString();
                string Name = ActiveFriend.GetValue("Name").AsString;
                FoundPlayer.Name = Name;

                ByteWriter BW = new ByteWriter();
                BW.AppendString(Name);
                BW.AppendInt32(ActiveFriend.GetValue("Level").AsInt32);
                FoundPlayer.Info = BW.GetBytes();
                BW.ClearWriteBuffer();

                ListFriend.Add(FoundPlayer);
            }

            return(ListFriend);
        }
示例#11
0
        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);
        }
示例#12
0
        public override void DoWrite(ByteWriter BW)
        {
            BW.AppendInt32(ActivePlayerIndex);
            BW.AppendInt32(ActiveSquadIndex);
            BW.AppendInt32(ActiveSquad.CurrentLeader.AttackIndex);
            BW.AppendInt32(ListAttackChoice.Count);

            for (int A = 0; A < ListAttackChoice.Count; ++A)
            {
                BW.AppendFloat(ListAttackChoice[A].X);
                BW.AppendFloat(ListAttackChoice[A].Y);
                BW.AppendInt32((int)ListAttackChoice[A].Z);
            }

            BW.AppendBoolean(BattlePreview != null);
            if (BattlePreview != null)
            {
                BW.AppendInt32(BattlePreview.PlayerIndex);
                BW.AppendInt32(BattlePreview.SquadIndex);
            }

            BW.AppendFloat(Map.CursorPosition.X);
            BW.AppendFloat(Map.CursorPosition.Y);
            BW.AppendFloat(Map.CursorPosition.Z);
        }
示例#13
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(ListBuildSpot.Count);
     for (int B = 0; B < ListBuildSpot.Count; ++B)
     {
         BW.AppendFloat(ListBuildSpot[B].X);
         BW.AppendFloat(ListBuildSpot[B].Y);
         BW.AppendFloat(ListBuildSpot[B].Z);
     }
 }
示例#14
0
 public void Write(ByteWriter BW)
 {
     BW.AppendString(Name);
     DoWrite(BW);
     BW.AppendInt32(ListNextChoice.Count);
     foreach (ActionPanel ActiveNextActionPanel in ListNextChoice)
     {
         ActiveNextActionPanel.Write(BW);
     }
 }
示例#15
0
        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);
        }
示例#16
0
        public PlayerPOCO LogInPlayer(string Login, string Password, string GameServerIP, int GameServerPort)
        {
            LocalPlayer FoundPlayer = FindPlayer(Login, Password);

            if (FoundPlayer == null && FindPlayer(Login, null) == null)
            {
                LocalPlayer NewPlayer = new LocalPlayer();
                NewPlayer.ID       = PlayerIDCount++.ToString();
                NewPlayer.Login    = Login;
                NewPlayer.Name     = Login;
                NewPlayer.Password = Password;
                NewPlayer.LoggedIn = true;
                NewPlayer.Level    = 1;
                NewPlayer.NumberOfFailedConnection = 0;

                FoundPlayer = NewPlayer;
                ListPlayer.Add(NewPlayer);
            }

            if (FoundPlayer == null)
            {
                return(LogInPlayer(Login + "1", Password, GameServerIP, GameServerPort));
            }
            else
            {
                ByteWriter BW = new ByteWriter();
                BW.AppendString(FoundPlayer.Name);
                BW.AppendInt32(FoundPlayer.Level);
                FoundPlayer.Info = BW.GetBytes();
                BW.ClearWriteBuffer();

                UpdatePlayerIsLoggedIn(FoundPlayer.ID, GameServerIP, GameServerPort);

                return(FoundPlayer);
            }
        }
示例#17
0
        public PlayerPOCO LogInPlayer(string Login, string Password, string GameServerIP, int GameServerPort)
        {
            FilterDefinition <BsonDocument> LastTimeCheckedFilter = Builders <BsonDocument> .Filter.Eq("Login", Login) & Builders <BsonDocument> .Filter.Eq("Password", Password);

            BsonDocument FoundPlayerDocument = PlayersCollection.Find(LastTimeCheckedFilter).FirstOrDefault();

            if (FoundPlayerDocument == null && PlayersCollection.Find(Builders <BsonDocument> .Filter.Eq("Login", Login)).FirstOrDefault() == null)
            {
                BsonDocument document = new BsonDocument
                {
                    { "Login", Login },
                    { "Name", Login },
                    { "Level", 1 },
                    { "Ranking", 1 },
                    { "License", 1 },
                    { "Guild", "" },
                    { "CharacterType", "Jack" },
                    { "GameServerIP", "" },
                    { "GameServerPort", 0 },
                    { "CommunicationServerIP", "" },
                    { "CommunicationServerPort", 0 },
                    { "Password", Password },
                    { "NumberOfFailedConnection", 0 },
                    { "Equipment",
                      new BsonArray
                      {
                          new BsonDocument {
                              { "Money", 0 }, { "EXP", 0 }
                          }
                      } },
                    { "Friends",
                      new BsonArray
                      {
                      } }
                };

                PlayersCollection.InsertOne(document);
                FoundPlayerDocument = PlayersCollection.Find(LastTimeCheckedFilter).FirstOrDefault();
            }

            bool LoggedIn = !string.IsNullOrEmpty(FoundPlayerDocument.GetValue("GameServerIP").AsString);

            if (LoggedIn)
            {
                return(LogInPlayer(Login + "1", Password, GameServerIP, GameServerPort));
            }
            else
            {
                PlayerPOCO FoundPlayer = new PlayerPOCO();
                FoundPlayer.ID = FoundPlayerDocument.GetValue("_id").AsObjectId.ToString();
                string Name = FoundPlayerDocument.GetValue("Name").AsString;
                FoundPlayer.Name = Name;

                ByteWriter BW = new ByteWriter();
                BW.AppendString(Name);
                BW.AppendInt32(FoundPlayerDocument.GetValue("Level").AsInt32);
                FoundPlayer.Info = BW.GetBytes();
                BW.ClearWriteBuffer();

                UpdatePlayerIsLoggedIn(FoundPlayer.ID, GameServerIP, GameServerPort);

                return(FoundPlayer);
            }
        }
示例#18
0
        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
            {
            }
        }
示例#19
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(ActivePlayerIndex);
     BW.AppendInt32(Movement);
 }
示例#20
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(ActivePlayerIndex);
     BW.AppendInt32(ActiveSquadIndex);
     BW.AppendInt32(ActionMenuSwitchSquadCursor);
 }
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(ActivePlayerIndex);
     BW.AppendInt32(VisibleDiceValue);
 }
示例#22
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(ConfirmMenuChoice);
 }
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(Map.BuildingMenuCursor);
 }
示例#24
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendBoolean(HasBeenSelected);
     BW.AppendInt32(StartingPlayerIndex);
 }
示例#25
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(SelectedUnitIndex);
 }
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendFloat(PlayerUnit.X);
     BW.AppendFloat(PlayerUnit.Y);
     BW.AppendInt32((int)PlayerUnit.Z);
 }
示例#27
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(ActivePlayerIndex);
     BW.AppendInt32(CardCursorIndex);
 }
示例#28
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(ActivePlayerIndex);
     BW.AppendInt32(ActiveSquadIndex);
     BW.AppendInt32(ActiveSquad.CurrentLeader.AttackIndex);
 }
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(ConstructionMenuIndex);
 }
示例#30
0
 public override void DoWrite(ByteWriter BW)
 {
     BW.AppendInt32(Index);
 }