Esempio n. 1
0
        public static void Load(ReceiveGPacket p)
        {
            int   roomId = p.readH();
            int   channelId = p.readH();
            int   type = p.readC();
            int   slotIdx = p.readC();
            int   areaId = 0;
            float x = 0, y = 0, z = 0;

            if (type == 0)
            {
                areaId = p.readC();
                x      = p.readT();
                y      = p.readT();
                z      = p.readT();
                if (p.getBuffer().Length > 21)
                {
                    SaveLog.warning("[Invalid BOMB0: " + BitConverter.ToString(p.getBuffer()) + "]");
                }
            }
            else if (type == 1)
            {
                if (p.getBuffer().Length > 8)
                {
                    SaveLog.warning("[Invalid BOMB1: " + BitConverter.ToString(p.getBuffer()) + "]");
                }
            }
            Channel ch = ChannelsXML.getChannel(channelId);

            if (ch == null)
            {
                return;
            }
            Room room = ch.getRoom(roomId);

            if (room != null && room.round.Timer == null && room._state == RoomState.Battle)
            {
                SLOT slot = room.getSlot(slotIdx);
                if (slot == null || slot.state != SLOT_STATE.BATTLE)
                {
                    return;
                }
                if (type == 0)
                {
                    InstallBomb(room,slot,areaId,x,y,z);
                }
                else if (type == 1)
                {
                    UninstallBomb(room,slot);
                }
            }
        }
Esempio n. 2
0
        public static void Load(ReceiveGPacket p)
        {
            int   id1  = (int)p.readH();
            int   id2  = (int)p.readH();
            byte  num1 = p.readC();
            byte  num2 = p.readC();
            int   num3 = p.readD();
            float num4 = p.readT();
            float num5 = p.readT();
            float num6 = p.readT();
            byte  num7 = p.readC();
            int   num8 = (int)num7 * 15;

            if (p.getBuffer().Length > 25 + num8)
            {
                Logger.warning("[Invalid DEATH: " + BitConverter.ToString(p.getBuffer()) + "]");
            }
            Channel channel = ChannelsXML.getChannel(id2);

            if (channel == null)
            {
                return;
            }
            Room room = channel.getRoom(id1);

            if (room == null || room.round.Timer != null || room._state != RoomState.Battle)
            {
                return;
            }
            SLOT slot1 = room.getSlot((int)num1);

            if (slot1 == null || slot1.state != SLOT_STATE.BATTLE)
            {
                return;
            }
            FragInfos kills = new FragInfos()
            {
                killerIdx   = num1,
                killingType = CharaKillType.DEFAULT,
                weapon      = num3,
                x           = num4,
                y           = num5,
                z           = num6,
                flag        = num2
            };
            bool isSuicide = false;

            for (int index = 0; index < (int)num7; ++index)
            {
                byte  num9        = p.readC();
                byte  hitspotInfo = p.readC();
                float num10       = p.readT();
                float num11       = p.readT();
                float num12       = p.readT();
                int   num13       = (int)p.readC();
                int   slotIdx     = (int)hitspotInfo & 15;
                SLOT  slot2       = room.getSlot(slotIdx);
                if (slot2 != null && slot2.state == SLOT_STATE.BATTLE)
                {
                    Frag frag = new Frag(hitspotInfo)
                    {
                        flag = (byte)num13,
                        victimWeaponClass = num9,
                        x = num10,
                        y = num11,
                        z = num12
                    };
                    if ((int)kills.killerIdx == slotIdx)
                    {
                        isSuicide = true;
                    }
                    kills.frags.Add(frag);
                }
            }
            kills.killsCount = (byte)kills.frags.Count;
            Game_SyncNet.genDeath(room,slot1,kills,isSuicide);
        }
Esempio n. 3
0
        public static void Load(ReceiveGPacket p)
        {
            int   id1     = (int)p.readH();
            int   id2     = (int)p.readH();
            int   num     = (int)p.readC();
            int   slotIdx = (int)p.readC();
            int   areaId  = 0;
            float x       = 0.0f;
            float y       = 0.0f;
            float z       = 0.0f;

            switch (num)
            {
            case 0:
                areaId = (int)p.readC();
                x      = p.readT();
                y      = p.readT();
                z      = p.readT();
                if (p.getBuffer().Length > 21)
                {
                    Logger.warning("[Invalid BOMB0: " + BitConverter.ToString(p.getBuffer()) + "]");
                    break;
                }
                break;

            case 1:
                if (p.getBuffer().Length > 8)
                {
                    Logger.warning("[Invalid BOMB1: " + BitConverter.ToString(p.getBuffer()) + "]");
                    break;
                }
                break;
            }
            Channel channel = ChannelsXML.getChannel(id2);

            if (channel == null)
            {
                return;
            }
            Room room = channel.getRoom(id1);

            if (room == null || room.round.Timer != null || room._state != RoomState.Battle)
            {
                return;
            }
            SLOT slot = room.getSlot(slotIdx);

            if (slot == null || slot.state != SLOT_STATE.BATTLE)
            {
                return;
            }
            if (num == 0)
            {
                Net_Room_C4.InstallBomb(room,slot,areaId,x,y,z);
            }
            else
            {
                if (num != 1)
                {
                    return;
                }
                Net_Room_C4.UninstallBomb(room,slot);
            }
        }
        public static void Load(ReceiveGPacket p)
        {
            int   roomId      = p.readH();
            int   channelId   = p.readH();
            byte  killerId    = p.readC();
            byte  dieObjectId = p.readC();
            int   weaponId    = p.readD();
            float killerX     = p.readT();
            float killerY     = p.readT();
            float killerZ     = p.readT();
            byte  killsCount  = p.readC();
            int   estimado    = (killsCount * 15);

            if (p.getBuffer().Length > (25 + estimado))
            {
                SaveLog.warning("[Invalid DEATH] Lenght > " + (25 + estimado) + " KillerId " + killerId + " Packet:" + BitConverter.ToString(p.getBuffer()) + "]");
                Printf.warning("Invalid death Killer Id " + killerId);
            }

            Channel ch = ChannelsXML.getChannel(channelId);

            if (ch == null)
            {
                return;
            }
            Room room = ch.getRoom(roomId);

            if (room != null && room.round.Timer == null && room._state == RoomState.Battle)
            {
                SLOT killer = room.getSlot(killerId);
                if (killer != null && killer.state == SLOT_STATE.BATTLE)
                {
                    FragInfos info = new FragInfos
                    {
                        killerIdx   = killerId,
                        killingType = 0, //1 - piercing | 2 - mass
                        weapon      = weaponId,
                        x           = killerX,
                        y           = killerY,
                        z           = killerZ,
                        flag        = dieObjectId
                    };
                    bool isSuicide = false;
                    for (int i = 0; i < killsCount; i++)
                    {
                        byte  weaponClass = p.readC();
                        byte  deathInfo   = p.readC();
                        float vicX        = p.readT();
                        float vicY        = p.readT();
                        float vicZ        = p.readT();
                        int   vicFlag     = p.readC();
                        int   victimId    = deathInfo & 15;
                        SLOT  victim      = room.getSlot(victimId);
                        if (victim != null && victim.state == SLOT_STATE.BATTLE)
                        {
                            Frag frag = new Frag(deathInfo)
                            {
                                flag = (byte)vicFlag,victimWeaponClass = weaponClass,x = vicX,y = vicY,z = vicZ
                            };
                            if (info.killerIdx == victimId)
                            {
                                isSuicide = true;
                            }
                            info.frags.Add(frag);
                        }
                    }
                    info.killsCount = (byte)info.frags.Count;
                    Game_SyncNet.genDeath(room,killer,info,isSuicide);
                }
            }
        }