Ejemplo n.º 1
0
        public void processObjectInteraction(StaticWorldObject staticWorldObject, GameObjectItem item)
        {
            WorldSocket.gameServerEntities.Add(staticWorldObject);
            UInt16 typeId = NumericalUtils.ByteArrayToUint16(staticWorldObject.type, 1);

            Store.currentClient.playerData.newViewIdCounter++; // It is just for a test Later we will change this to have a List with Views and Object IDs

            NumericalUtils.uint16ToByteArrayShort(Store.currentClient.playerData.assignSpawnIdCounter());
            ServerPackets packets = new ServerPackets();

            packets.sendSystemChatMessage(Store.currentClient, "Door ID " + staticWorldObject.mxoId + " Type ID " + typeId.ToString() + " POS X:" + staticWorldObject.pos_x.ToString() + " Y:" + staticWorldObject.pos_y.ToString() + " Z:" + staticWorldObject.pos_z.ToString() + typeId, "BROADCAST");


            switch (typeId)
            {
            case 343:
            case 346:
            case 359:
            case 365:
            case 414:
            case 415:
            case 416:
            case 576:
            case 6958:
            case 6965:
            case 6963:
            case 6964:
            case 6972:
                // ObjectAttribute364
                ObjectAttributes364 door364 = new ObjectAttributes364("DOOR364", typeId, staticWorldObject.mxoId);
                door364.DisableAllAttributes();
                door364.Orientation.enable();
                door364.Position.enable();
                door364.CurrentState.enable();
                // Set Values
                door364.Position.setValue(NumericalUtils.doublesToLtVector3d(staticWorldObject.pos_x, staticWorldObject.pos_y, staticWorldObject.pos_z));
                door364.CurrentState.setValue(StringUtils.hexStringToBytes("34080000"));
                door364.Orientation.setValue(StringUtils.hexStringToBytes(staticWorldObject.quat));
                //door364.Orientation.setValue(StringUtils.hexStringToBytes("000000000000803F0000000000000000")); // ToDo: Replace it with staticWorldObject.quat when it is okay

                // ToDo: We make a little Entity "Hack" so that we have a unique id : metrid + fullmxostatic_id is entity
                String entityMxOHackString = "" + staticWorldObject.metrId + "" + staticWorldObject.mxoId;
                UInt64 entityId            = UInt64.Parse(entityMxOHackString);

                packets.sendSpawnStaticObject(Store.currentClient, door364, entityId);

                break;

            case 6601:
            case 6994:
            case 341:
            case 417:
            case 419:

                ObjectAttributes363 door363 = new ObjectAttributes363("DOOR363", typeId, staticWorldObject.mxoId);
                door363.DisableAllAttributes();
                door363.Orientation.enable();
                door363.Position.enable();
                door363.CurrentState.enable();
                // Set Values
                door363.Position.setValue(NumericalUtils.doublesToLtVector3d(staticWorldObject.pos_x, staticWorldObject.pos_y, staticWorldObject.pos_z));
                door363.Orientation.setValue(StringUtils.hexStringToBytes(staticWorldObject.quat));
                //door363.Orientation.setValue(StringUtils.hexStringToBytes("000000000000803F0000000000000000")); // ToDo: Replace it with staticWorldObject.quat when it is okay
                door363.CurrentState.setValue(StringUtils.hexStringToBytes("34080000"));

                // ToDo: We make a little Entity "Hack" so that we have a unique id : metrid + fullmxostatic_id is entity
                String entity363MxOHackString = "" + staticWorldObject.metrId + "" + staticWorldObject.mxoId;
                UInt64 entity363Id            = UInt64.Parse(entity363MxOHackString);

                packets.sendSpawnStaticObject(Store.currentClient, door363, entity363Id);
                break;

            case 592:
                new TeleportHandler().processHardlineExitRequest();
                break;

            default:
                new ServerPackets().sendSystemChatMessage(Store.currentClient, "Unknown Object Interaction with Object Type " + staticWorldObject.type + " and Name " + item.getName(), "MODAL");
                break;
            }
        }