public static List <HitData> ReadInfo(ReceivePacket p, bool genLog)
        {
            List <HitData> hits  = new List <HitData>();
            int            count = p.readC();

            for (int k = 0; k < count; k++)
            {
                HitData hit = new HitData
                {
                    _hitInfo    = p.readUD(),
                    _weaponInfo = p.readUH(),
                    _weaponSlot = p.readC(),
                    _unk        = p.readUH(),
                    _eixoX      = p.readUH(),
                    _eixoY      = p.readUH(),
                    _eixoZ      = p.readUH()
                };
                if (genLog)
                {
                    Printf.warning("P: " + hit._eixoX + ";" + hit._eixoY + ";" + hit._eixoZ);
                    Printf.warning("[" + k + "] 16384: " + BitConverter.ToString(p.getBuffer()));
                }
                hits.Add(hit);
            }
            return(hits);
        }
Пример #2
0
        private static Struct BaseReadInfo(ReceivePacket p, bool OnlyBytes, bool genLog)
        {
            Struct info = new Struct
            {
                _weaponInfo    = p.readUH(),
                _weaponSlot    = p.readC(),
                _unk           = p.readUH(),
                _objPos_x      = p.readUH(),
                _objPos_y      = p.readUH(),
                _objPos_z      = p.readUH(),
                _unk5          = p.readUH(),
                _unk6          = p.readUH(),
                _unk7          = p.readUH(),
                _grenadesCount = p.readUH()
            };                       //id do item do mapa

            info._unk8 = p.readB(6); //Null 1.15.37

            /*
             * 1.15.42 - p.readB(6);
             */
            if (!OnlyBytes)
            {
                info.WeaponNumber = (info._weaponInfo >> 6);
                info.WeaponClass  = (info._weaponInfo & 47);
            }
            if (genLog)
            {
                Printf.warning("[code1_GrenadeSync] " + BitConverter.ToString(p.getBuffer()));
                Printf.warning("[code1_GrenadeSync] wInfo: " + info._weaponInfo + "; wSlot: " + info._weaponSlot + "; u: " + info._unk + "; obpX: " + info._objPos_x + "; obpY: " + info._objPos_y + "; obpZ: " + info._objPos_z + "; u5: " + info._unk5 + "; u6: " + info._unk6 + "; u7: " + info._unk7 + "; u8: " + info._unk8);
            }
            return(info);
        }
 public override void run()
 {
     try
     {
         Printf.warning("3329 Received");
         Account p = _client._player;
         if (p == null)
         {
             return;
         }
         Room room = p._room;
         SaveLog.warning("BATTLE_3329_REC. (PlayerID: " + p.player_id + "; Name: " + p.player_name + "; Room: " + (p._room != null ? p._room._roomId : -1) + "; Channel: " + p.channelId + ")");
         if (room != null)
         {
             SaveLog.warning("Room3329; BOT: " + room.isBotMode());
             SLOT slot = room.getSlot(p._slotId);
             if (slot != null)
             {
                 SaveLog.warning("SLOT Id: " + slot._id + "; State: " + slot.state);
             }
         }
         p.SendPacket(new SERVER_MESSAGE_ANNOUNCE_PAK("Voce usou uma função que estamos investigando, entre em contato com os administradores!"));
         _client.SendPacket(new A_3329_PAK());
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[BATTLE_3329_REC.run] Erro fatal!");
     }
 }
 public void SendCompletePacket(byte[] data)
 {
     try
     {
         if (data.Length < 4)
         {
             return;
         }
         if (ConfigGA.debugMode)
         {
             ushort opcode    = BitConverter.ToUInt16(data, 2);
             string debugData = "";
             foreach (string str2 in BitConverter.ToString(data).Split('-', ',', '.', ':', '\t'))
             {
                 debugData += " " + str2;
             }
             Printf.warning("[" + opcode + "]" + debugData);
         }
         _client.BeginSend(data, 0, data.Length, SocketFlags.None, new AsyncCallback(SendCallback), _client);
     }
     catch
     {
         Close(true);
     }
 }
 public void SendPacket(byte[] data)
 {
     try
     {
         if (data.Length < 2)
         {
             return;
         }
         ushort      size = Convert.ToUInt16(data.Length - 2);
         List <byte> list = new List <byte>(data.Length + 2);
         list.AddRange(BitConverter.GetBytes(size));
         list.AddRange(data);
         byte[] result = list.ToArray();
         if (ConfigGA.debugMode)
         {
             ushort opcode    = BitConverter.ToUInt16(data, 0);
             string debugData = "";
             foreach (string str2 in BitConverter.ToString(result).Split('-', ',', '.', ':', '\t'))
             {
                 debugData += " " + str2;
             }
             Printf.warning("[" + opcode + "]" + debugData);
         }
         if (result.Length > 0)
         {
             _client.BeginSend(result, 0, result.Length, SocketFlags.None, new AsyncCallback(SendCallback), _client);
         }
         list.Clear();
     }
     catch {
         Close(true);
     }
 }
        private static List <HitData> BaseReadInfo(ReceivePacket p, bool OnlyBytes, bool genLog)
        {
            List <HitData> hits  = new List <HitData>();
            int            count = p.readC();

            for (int i = 0; i < count; i++)
            {
                HitData hit = new HitData
                {
                    _hitInfo    = p.readUD(),
                    _weaponInfo = p.readUH(),
                    _weaponSlot = p.readC(),
                    PlayerPos   = p.readUHVector()
                };
                if (!OnlyBytes)
                {
                    hit.WeaponClass = (ClassType)((hit._weaponInfo >> 32) & 63); //Funcional? Antigo = >> 32) & 31 | Novo = >> 32) & 63
                    hit.WeaponId    = (hit._weaponInfo >> 6);
                }
                if (genLog)
                {
                    Printf.warning("[" + i + "] Committed suicide: hitinfo,weaponinfo,weaponslot,camX,camY,camZ (" + hit._hitInfo + ";" + hit._weaponInfo + ";" + hit._weaponSlot + ";" + hit.PlayerPos.X + ";" + hit.PlayerPos.Y + ";" + hit.PlayerPos.Z + ")");
                }
                hits.Add(hit);
            }
            return(hits);
        }
Пример #7
0
        private static void AcceptCallback(IAsyncResult result)
        {
            Socket clientSocket = (Socket)result.AsyncState;

            try
            {
                Socket handler = clientSocket.EndAccept(result);
                if (handler != null)
                {
                    LoginClient client = new LoginClient(handler);
                    AddSocket(client);
                    if (client == null)
                    {
                        Printf.warning("LoginClient destruído após falha ao adicionar na lista.");
                    }
                    Thread.Sleep(5);
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString());
                Printf.b_danger("[LoginManager.AcceptCallback] [Failed a LC connection] Erro fatal!");
            }
            mainSocket.BeginAccept(new AsyncCallback(AcceptCallback), mainSocket);
        }
        public bool CheckSeed(byte[] decryptedData, bool isTheFirstPacket)
        {
            int hashReceive = (int)BitConverter.ToUInt16(decryptedData, 2);

            if (hashReceive == GetNextSessionSeed())
            {
                return(true);
            }

            if (_player != null)
            {
                SaveLog.warning("[Seed] Seed invalida recebida após login. [Recebido: " + hashReceive + "; Esperava-se: " + NextSessionSeed + "] [Id: " + _player.player_id + "; Login: "******"; TotalPks: " + CountReceivedpackets + "] - " + GetIPAddress());
                Printf.warning("[Invalid Seed] Client valido enviou seed invalida [pId:" + _player.player_id + "; Login: "******"] ");
            }
            else
            {
                SaveLog.warning("[Seed] Recebido: " + hashReceive + "; Esperava-se: " + NextSessionSeed + " - " + GetIPAddress() + "");
                Printf.warning("[Invalid Seed] Receive: " + hashReceive + " - " + GetIPAddress());
            }

            Firewall.sendBlock(GetIPAddress(), "[Auth] Seed invalida", 1);
            Close(true);

            if (isTheFirstPacket)
            {
                new Thread(read).Start();
            }
            return(false);
        }
Пример #9
0
 /// <summary>
 /// Reseta as informações da sala, caso a rodada seja válida.
 /// </summary>
 /// <param name="round">Rodada</param>
 /// <returns></returns>
 public bool RoundResetRoomF1(int round)
 {
     lock (_lock)
     {
         if (LastRound != round)
         {
             if (Config.isTestMode)
             {
                 Printf.warning("Reseting room. [Last: " + LastRound + "; New: " + round + "]");
             }
             DateTime now = DateTime.Now;
             LastRound      = round;
             _hasC4         = false;
             BombPosition   = new Half3();
             _dropCounter   = 0;
             _objsSyncRound = 0;
             _sourceToMap   = _mapId;
             if (!_isBotMode)
             {
                 for (int i = 0; i < 16; i++)
                 {
                     Player player = _players[i];
                     player._life = player._maxLife;
                 }
                 LastPlayersSync = now;
                 Map             = MappingXML.getMapById(_mapId);
                 List <ObjModel> objsm = Map != null ? Map._objects : null;
                 if (objsm != null)
                 {
                     for (int i = 0; i < objsm.Count; i++)
                     {
                         ObjModel   ob  = objsm[i];
                         ObjectInfo obj = _objects[ob._id];
                         obj._life = ob._life;
                         if (!ob._noInstaSync)
                         {
                             ob.GetARandomAnim(this, obj);
                         }
                         else
                         {
                             obj._anim = new AnimModel {
                                 _nextAnim = 1
                             };
                             obj._useDate = now;
                         }
                         obj._model       = ob;
                         obj.DestroyState = 0;
                         MappingXML.SetObjectives(ob, this);
                     }
                 }
                 LastObjsSync   = now;
                 _objsSyncRound = round;
             }
             return(true);
         }
     }
     return(false);
 }
Пример #10
0
 /// <summary>
 /// Reseta as informações da sala, caso a rodada seja válida.
 /// </summary>
 /// <param name="round">Rodada</param>
 /// <returns></returns>
 public bool RoundResetRoomS1(int round)
 {
     lock (_lock)
     {
         if (LastRound != round)
         {
             if (Config.isTestMode)
             {
                 Printf.warning("Reseting room. [Last: " + LastRound + "; New: " + round + "]");
             }
             LastRound    = round;
             _hasC4       = false;
             _dropCounter = 0;
             BombPosition = new Half3();
             if (!_isBotMode)
             {
                 for (int i = 0; i < 16; i++)
                 {
                     Player player = _players[i];
                     player._life = player._maxLife;
                 }
                 DateTime now = DateTime.Now;
                 LastPlayersSync = now;
                 for (int i = 0; i < _objects.Length; i++)
                 {
                     ObjectInfo obj = _objects[i];
                     ObjModel   ob  = obj._model;
                     if (ob != null)
                     {
                         obj._life = ob._life;
                         if (!ob._noInstaSync)
                         {
                             ob.GetARandomAnim(this, obj);
                         }
                         else
                         {
                             obj._anim = new AnimModel {
                                 _nextAnim = 1
                             };
                             obj._useDate = now;
                         }
                         obj.DestroyState = 0;
                     }
                 }
                 LastObjsSync   = now;
                 _objsSyncRound = round;
                 if ((stageType == 3 || stageType == 5))
                 {
                     _bar1 = _default1;
                     _bar2 = _default2;
                 }
             }
             return(true);
         }
     }
     return(false);
 }
        public static void Load(ReceiveGPacket p)
        {
            int  roomId    = p.readH();
            int  channelId = p.readH();
            byte killerIdx = p.readC();
            byte deathtype = p.readC();
            byte hitEnum   = p.readC();
            int  damage    = p.readH();

            if (p.getBuffer().Length > 11)
            {
                Printf.warning("Invalid hitMaker");
                SaveLog.warning("[Invalid MARKER: " + BitConverter.ToString(p.getBuffer()) + "]");
                return; // teste
            }


            Channel ch = ChannelsXML.getChannel(channelId);

            if (ch == null)
            {
                return;
            }


            Room room = ch.getRoom(roomId);

            if (room != null && room._state == RoomState.Battle)
            {
                Account player = room.getPlayerBySlot(killerIdx);
                if (player != null)
                {
                    string warn = "";
                    if (deathtype == 10)
                    {
                        warn = Translation.GetLabel("LifeRestored", damage);
                    }
                    else if (hitEnum == 0)
                    {
                        warn = Translation.GetLabel("HitMarker1", damage);
                    }
                    else if (hitEnum == 1)
                    {
                        warn = Translation.GetLabel("HitMarker2", damage);
                    }
                    else if (hitEnum == 2)
                    {
                        warn = Translation.GetLabel("HitMarker3");
                    }
                    else if (hitEnum == 3)
                    {
                        warn = Translation.GetLabel("HitMarker4");
                    }
                    player.SendPacket(new LOBBY_CHATTING_PAK(Translation.GetLabel("HitMarkerName"), player.getSessionId(), 0, true, warn));
                }
            }
        }
Пример #12
0
 protected internal void Advance(int bytes)
 {
     _offset += bytes;
     if (_offset > _buffer.Length)
     {
         Printf.warning("[ReceivePacket.Advance] - Offset passou do limite!");
         SaveLog.warning("[ReceivePacket.Advance] - Offset passou do limite!");
         throw new Exception("Offset ultrapassou o valor do buffer.");
     }
 }
Пример #13
0
 public static Struct readSyncInfo(ActionModel ac, ReceivePacket p, bool genLog)
 {
     Struct info = new Struct
     {
         _spaceFlags = (CharaMoves)p.readC(),
         _objId = p.readUH()
     };
     if (genLog)
         Printf.warning("Slot " + ac._slot + " action 8: (" + info._spaceFlags + ";" + info._objId + ")");
     return info;
 }
        public static Struct readSyncInfo(ReceivePacket p, bool genLog)
        {
            Struct info = new Struct
            {
                _unk = p.readB(9)
            }; //160 existe no mapa OUTPOST

            if (genLog)
            {
                Printf.warning("[code13_ControledObj] " + BitConverter.ToString(info._unk));
            }
            return(info);
        }
        private static void LoadBox(int id)
        {
            string path = "data/cupons/" + id + ".xml";

            if (File.Exists(path))
            {
                parse(path, id);
            }
            else
            {
                Printf.warning("[RandomBoxXML] Não existe o arquivo: " + path);
            }
        }
Пример #16
0
        public static void Load()
        {
            string path = "data/battle/exceptions.xml";

            if (File.Exists(path))
            {
                parse(path);
            }
            else
            {
                Printf.warning("[MeleeExceptionsXML] Não existe o arquivo: " + path);
            }
        }
Пример #17
0
        public static void Load()
        {
            string path = "data/ranktemplate/rankplayertemplate.xml";

            if (File.Exists(path))
            {
                parse(path);
            }
            else
            {
                Printf.warning("[RankXML] Não existe o arquivo: " + path);
            }
        }
Пример #18
0
        private static void Load(string file, int type)
        {
            string path = "data/missions/" + file + ".mqf";

            if (File.Exists(path))
            {
                parse(path, file, type);
            }
            else
            {
                Printf.warning("[MissionCardXML] Não existe o arquivo: " + path);
            }
        }
Пример #19
0
        public static Struct ReadInfo(ActionModel ac, ReceivePacket p, bool genLog)
        {
            Struct info = new Struct
            {
                _portal = p.readUH()
            };

            if (genLog)
            {
                Printf.warning("Slot " + ac._slot + " passed on the portal [" + info._portal + "]");
            }
            return(info);
        }
Пример #20
0
        public static Struct readSyncInfo(ReceivePacket p, bool genLog)
        {
            Struct info = new Struct
            {
                _isDestroyed = p.readC() //0=Normal|1=Quebrado
            };

            if (genLog)
            {
                Printf.warning("[code9_StageInfoObjStatic] u: " + info._isDestroyed);
            }
            return(info);
        }
        public static void Load()
        {
            string path = "data/titles/title_awards2.xml";

            if (File.Exists(path))
            {
                parse(path);
            }
            else
            {
                Printf.warning("[TitleAwards] Não existe o arquivo: " + path);
            }
        }
        public static void Load()
        {
            string path = "data/cards/MissionAwards.xml";

            if (File.Exists(path))
            {
                parse(path);
            }
            else
            {
                Printf.warning("[MissionAwards] Não existe o arquivo: " + path);
            }
        }
Пример #23
0
        public static Struct ReadInfo(ActionModel ac, ReceivePacket p, bool genLog)
        {
            Struct info = new Struct
            {
                _unkV = p.readUH()
            }; //?

            if (genLog)
            {
                Printf.warning("Slot " + ac._slot + " is moving the crosshair position: posV (" + info._unkV + ")");
            }
            return(info);
        }
 public override void run()
 {
     try
     {
         Account player = _client._player;
         if (player == null)
         {
             return;
         }
         Room room = player._room;
         if (room == null || room.round.Timer != null || room._state < RoomState.Battle)
         {
             return;
         }
         bool isBotMode = room.isBotMode();
         SLOT killer    = room.getSlot(kills.killerIdx);
         if (killer == null || !isBotMode && (killer.state < SLOT_STATE.BATTLE || killer._id != player._slotId))
         {
             return;
         }
         int score;
         Net_Room_Death.RegistryFragInfos(room,killer,out score,isBotMode,isSuicide,kills);
         if (isBotMode)
         {
             killer.Score += killer.killsOnLife + room.IngameAiLevel + score;
             if (killer.Score > 65535)
             {
                 _client.SendPacket(new AUTH_ACCOUNT_KICK_PAK(0));
                 killer.Score = 65535;
                 Printf.warning("O jogador " + player.player_name + " ultrapassou 65535 pontos no modo Bot");
                 SaveLog.LogAbuse("[Bot Mode] Score máximo atingido [Nick: " + player.player_name + "; Id: " + _client.player_id + "]");
             }
             kills.Score = killer.Score;
         }
         else
         {
             killer.Score += score;
             AllUtils.CompleteMission(room,player,killer,kills,MISSION_TYPE.NA,0);
             kills.Score = score;
         }
         using (BATTLE_DEATH_PAK packet = new BATTLE_DEATH_PAK(room,kills,killer,isBotMode))
             room.SendPacketToPlayers(packet,SLOT_STATE.BATTLE,0);
         Net_Room_Death.EndBattleByDeath(room,killer,isBotMode,isSuicide);
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[BATTLE_DEATH_REC.run] Erro fatal!");
         _client.Close(0);
     }
 }
        private static void parse(string path)
        {
            XmlDocument xmlDocument = new XmlDocument();

            using (FileStream fileStream = new FileStream(path, FileMode.Open))
            {
                if (fileStream.Length == 0)
                {
                    Printf.warning("[WelcomeXML] O arquivo está vazio: " + path);
                }
                else
                {
                    try
                    {
                        xmlDocument.Load(fileStream);
                        for (XmlNode xmlNode1 = xmlDocument.FirstChild; xmlNode1 != null; xmlNode1 = xmlNode1.NextSibling)
                        {
                            if ("list".Equals(xmlNode1.Name))
                            {
                                for (XmlNode xmlNode2 = xmlNode1.FirstChild; xmlNode2 != null; xmlNode2 = xmlNode2.NextSibling)
                                {
                                    if ("msg".Equals(xmlNode2.Name))
                                    {
                                        XmlNamedNodeMap xml = xmlNode2.Attributes;

                                        WelcomeModel ev = new WelcomeModel
                                        {
                                            _title = xml.GetNamedItem("title").Value,
                                            _txt   = xml.GetNamedItem("text").Value,
                                            _color = short.Parse(xml.GetNamedItem("color").Value)
                                        };
                                        _welcome.Add(ev);
                                    }
                                }
                            }
                        }
                        if (_welcome.Count == 0)
                        {
                            Printf.warning("[Aviso] Não existe mensagem de boas vindas");
                        }
                    }
                    catch (XmlException ex)
                    {
                        SaveLog.fatal(ex.ToString());
                        Printf.b_danger("[WelcomeXML.Parse] Erro fatal!");
                    }
                }
                fileStream.Dispose();
                fileStream.Close();
            }
        }
        public static Struct readSyncInfo(ActionModel ac, ReceivePacket p, bool genLog)
        {
            Struct info = new Struct
            {
                _radioId = p.readC(),
                _areaId  = p.readC()
            };

            if (genLog)
            {
                Printf.warning("Slot " + ac._slot + " released a radio chat: radId, areaId [" + info._radioId + ";" + info._areaId + "]");
            }
            return(info);
        }
Пример #27
0
        public static Struct ReadInfo(ReceivePacket p, bool genLog)
        {
            Struct info = new Struct
            {
                Life            = p.readUH(),
                DestroyedBySlot = p.readC()
            };

            if (genLog)
            {
                Printf.warning("[code3_ObjectStatic] Life: " + info.Life + "; DestroyedBy: " + info.DestroyedBySlot);
            }
            return(info);
        }
Пример #28
0
        public static Struct readSyncInfo(ActionModel ac, ReceivePacket p, bool genLog)
        {
            Struct info = new Struct
            {
                _unkV  = p.readC(),
                _unkV2 = p.readC()
            };

            if (genLog)
            {
                Printf.warning("Slot " + ac._slot + " action 16: unk (" + info._unkV + ";" + info._unkV2 + ")");
            }
            return(info);
        }
Пример #29
0
        public static Struct ReadInfo(ActionModel ac, ReceivePacket p, bool genLog)
        {
            Struct info = new Struct
            {
                _hitEffects = p.readC(), //&15 = Qm deu o dano | >>4 = Tipo do dano (CHARA_DEATH)
                _hitPart    = p.readC()  //Número do efeito??
            };

            if (genLog)
            {
                Printf.warning("[1] Effect: " + (info._hitEffects >> 4) + "; By slot: " + (info._hitEffects & 15));
                Printf.warning("[2] Slot " + ac._slot + " action 524288: " + info._hitEffects + ";" + info._hitPart);
            }
            return(info);
        }
Пример #30
0
 /// <summary>
 /// Checa se a data de ínicio da partida é válida. Caso seja válida, reseta as informações da sala, como objetos, informações de drop..
 /// </summary>
 /// <param name="newvalue">Nova data</param>
 /// <param name="gen2">Informações da sala (Mapa/Tipo)</param>
 public void ResyncTick(long startTick, int gen2)
 {
     if (startTick > LastStartTick)
     {
         _startTime = new DateTime(startTick);
         if (LastStartTick > 0)
         {
             ResetRoomInfo(gen2);
         }
         LastStartTick = startTick;
         if (Config.isTestMode)
         {
             Printf.warning("[New tick is defined]");
         }
     }
 }